可学答题网 > 问答 > SCJP程序员认证考试题库
目录: 标题| 题干| 答案| 搜索| 相关
问题

Which of the followi


Which of the following statements about declaration are true?()         

  • A Declaration of primitive types such as boolean, byte and so on does not allocate memory space for the variable.
  • B Declaration of primitive types such as boolean, byte and so on allocates memory space for the variable.
  • C Declaration of nonprimitive types such as String, Vector and so on does not allocate memory space for the object.
  • D Declaration of nonprimitive types such as String, Vector ans so on allocates memory space for the object.
参考答案
参考解析:

对原始数据类型的变量的声明将为之分配内存并赋予一个缺省值,参见23题的叙述,而非原始数据类型的变量必须用new Xxxx()分配内存及初始化。但是严格来讲此题的答案有待确定,因为只有原始类型的实例变量和类变量的声明在类对象被创建/类被加载时完成内存的自动分配,而原始类型的局部变量必须显式初始化,从这点来看原始类型的局部变量没有被自动分配内存,SL275中只提出了非原始数据类型的变量必须使用new Xxxx()完成内存的分配而没有指出原始数据类型的变量是否在声明时即自动进行内存分配,而从局部变量不能在显式初始化前使用这点来看在声明时没有进行内存分配。因此答案a的正确性还有待官方的确定。

分类:SCJP程序员认证考试题库
相关推荐

1、Which of the followi

Which of the following is a true statement when promiscuous mode is enabled on an...

2、Which of the followi

Which of the following accurately represents the functionality of a lightweight access point&...

3、Which of the followi

Which of the following is not a CRS Telephony or Media Subsystem?()AJTAPI BCisco Media CVXML DMRCP ASR EMRCP TTS&e

4、Which of the followi

Which of the following characteristics applies only to OSPFv3 and not to OSPFv2?()ASeveral...

5、Which of the followi

Which of the following four CRS components must be active on a Historical Reporting&#81...

6、Which of the followi

Which of the following statements are true?() A The equals() method determines if refere...