快来看看这道题该选什么?

wulingdongliu 2002-12-28 02:56:45
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 and so on allocates memory space for the object.
...全文
24 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
tzh127 2003-04-09
  • 打赏
  • 举报
回复
I prefer b & c. Because Java does not support the variable string,so you must give a definition of the length of the string before you use this string.that is
to say you must allocate the memory space of the nonprimitive types .
gmleon 2003-04-06
  • 打赏
  • 举报
回复
B & C are correct answers.

AClass aClass; - No memory allocated.

aClass = new AClass(); - momory actually allocated.
willowfly 2003-04-04
  • 打赏
  • 举报
回复
shi bu shi b a
lijing725 2003-04-03
  • 打赏
  • 举报
回复
b d
tonypotter 2003-04-03
  • 打赏
  • 举报
回复
of cause
b & c is correct
ktyl2000 2003-04-02
  • 打赏
  • 举报
回复
I thing C is true;
zi_feng 2003-04-02
  • 打赏
  • 举报
回复
BC
redv 2003-04-01
  • 打赏
  • 举报
回复
B & C

简单类型赋于初始值,如boolean初始值为false

而像Vector的只是一个指向null的“指针”般的东西。
njbxc 2003-04-01
  • 打赏
  • 举报
回复
我觉得没有一个对的,class-level中的声明是会分配内存的,可是local的不会!
flyspider 2002-12-29
  • 打赏
  • 举报
回复
B
jinhuaxing 2002-12-29
  • 打赏
  • 举报
回复
BC
wulingdongliu 2002-12-28
  • 打赏
  • 举报
回复
只有这一个答案吗?
andytu 2002-12-28
  • 打赏
  • 举报
回复
I think D is true.Because the boolean variable does not allocate memory space.and all the nonprimitive type allocate memory space for the object and the reference.

50,549

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧