格林模拟试题二参考答案

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

 

answer 8)

1)compile time error: base cannot be private

a top leve (non nested) class cannot be private.


answer 9)

4) p1 compiles cleanly but p2 has an error at compile time

the package statement in p1.java is the equivalent of placing the file in a different directory to the file p2.java and thus when the compiler tries to compile p2 an error occurs indicating that superclass p1 cannot be found.


answer 10)

2) an error at run time

this code will compile, but at run-time you will get an arrayindexoutofbounds exception. this becuase counting in java starts from 0 and so the 5th element of this array would be i[4].

remember that arrays will always be initialized to default values wherever they are created.


answer 11)

2)myarray.length;

the string class has a length() method to return the number of characters. i have sometimes become confused between the two.


answer 12)

3) a frame with one large button marked four in the centre

the default layout manager for a frame is the borderlayout manager. this layout manager defaults to placing components in the centre if no constraint is passed with the call to the add method.


answer 13)

4) do nothing, the flowlayout will position the component


answer 14)

1) use the setlayout method

视频学习

我考网版权与免责声明

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

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

最近更新

社区交流

考试问答