格林模拟试题二参考答案

来源:java认证发布时间:2012-11-12 12:47:44java认证视频

 

answer 23)

4) the class can only access final variables


answer 24)


1) to call from the currently running thread to allow another thread of the same or higher priority to run

option 3 looks plausible but there is no guarantee that the thread that grabs the cpu time will be of a higher priority. it will depend on the threading algorithm of the java virtual machine and the underlying operating system


answer 25)


4) compilation and running with output 0 to 9


answer 26)

1) none of these options

because of the lack of a break statement after the break 10; statement the actual output will be

"ten" followed by "twenty"


answer 27)

4) system.gc();


answer 28)

1) compilation succeeds and at run time an output of 0 and false
the default value for a boolean declared at class level is false, and integer is 0;


answer 29)

1) compile time error

you will get an error saying something like "cant make a static reference to a non static variable". note that the main method is static. even if main was not static the array argv is local to the main method and would thus not be visible within amethod.


answer 30)

3) output of "not equal"

despite the actual character strings matching, using the == operator will simply compare memory location. because the one string was created with the new operator it will be in a different location in memory to the other string.

视频学习

我考网版权与免责声明

① 凡本网注明稿件来源为"原创"的所有文字、图片和音视频稿件,版权均属本网所有。任何媒体、网站或个人转载、链接转贴或以其他方式复制发表时必须注明"稿件来源:我考网",违者本网将依法追究责任;

② 本网部分稿件来源于网络,任何单位或个人认为我考网发布的内容可能涉嫌侵犯其合法权益,应该及时向我考网书面反馈,并提供身份证明、权属证明及详细侵权情况证明,我考网在收到上述法律文件后,将会尽快移除被控侵权内容。

最近更新

社区交流

考试问答