格林模拟试题一参考答案

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

 

answer 19)

4) compilation and output of either "vandaleur", "vandaleur 0", "vandaleur 0 1" "vandaleur 0 1 2" or "vandaleur 0 1 2 3"

if that seems a vauge answer it is because you cannot be certain of the system that the underlying os uses for allocating cycles for a thread. the chances are that once the thread has been spun off in the call to start in the method piggy the main method will run to completion and the value of sname will still be vandeluer before the thread modifies it. you cannot be certain of this though.


answer 20)

3) one button occupying the entire frame saying bye

the default layout manager for a frame is a border layout. if directions are not given (ie north, south, east or west), any button will simply go in the centre and occupy all the space. an additional button will simply be placed over the previous button. what you would probably want in a real example is to set up a flow layout as in

setlayout(new flowlayout()); 


which would allow the buttons to both appear side by side, given the appropriate font and size.
applets and panels have a default flowlayout manager


answer 21)

1,2

value for i=1 value for j=1
value for i=2 value for j=1
 

the statement continue outer causes the code to jump to the label outer and the for loop increments to the next number.


answer 22)

4) runtime error, an exception will be thrown

a call to wait/notify must be within synchronized code. with jdk1.2 this code throws the error message

java.lang.illegalmonitorstateexception: current thread not owner
at java.lang.object.wait(native method)
at java.lang.object.wait(object.java:424)
at dsross.notwait(compiled code)
at dsross.run(agg.java:21)


answer 23)

2,3

options 1, & 4 will not compile as they attempt to throw exceptions not declared in the base class. because options 2 and 3 take a parameter of type long they represent overloading not overriding and there is no such limitations on overloaded methods.

视频学习

我考网版权与免责声明

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

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

最近更新

社区交流

考试问答