多选题 You need to create a class to store information about books contained in a library. What variable scope is best suited for the variable that will store the title of a book?
  • A. Local variable
  • B. Static variable
  • C. Global variable
  • D. Method parameter
  • E. Instance variable
【正确答案】 E
【答案解析】在存储与书相关信息的类中,你希望将书的标题存储到将驻留在对象整个生命周期内的一个变量中。A、B、C和D不正确。A不正确,因为局部变量最适合于只在短时间内使用的数据。B不正确,因为静态或者类变量最适合于类的所有对象都需要访问的数据。C不正确,因为在Java中不建议全局变量,并且在这种情形下是不合理的。D不正确,因为它只能用于方法。