SCJP试题-SCJPMockExam2

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



Answer to Question 56)

Objective 5.1)

1) System.out.println(i++);
3) System.out.println(i);
4) System.out.println(i--);

The options for this question might look suspiciously easy if you are not aware of the effects of the post-increment operators. The ++ and -- operations for examples 1 and 4 only come into effect after the output operations, ie after whatever else is done to them on that line of code. Option 2 should be fairly obvious as you should know that the single quote characters indicate a char value, ie storing the character rather than the numberical value for 0.

http://www.jchq.net/tutorial/05_01Tut.htm


--------------------------------------------------------------------------------

Answer to Question 57)

Objective 6.2)

4) System.out.println( ((Agg) a).getFields());

The Base type reference to the ins

The Base type reference to the instance of the class Agg needs to be cast from Base to Agg to get access to its methods.The method invoked depends on the object itself, not on the declared type. So, a.getField() invokes getField() in the Base class, which displays Base. But the call to ((Agg)a).getField() will invoke the getField() in the Agg class. You will be unlucky to get a question as complex as this on the exam.

http://www.jchq.net/tutorial/06_02Tut.htm


--------------------------------------------------------------------------------

Answer to Question 58)

Objective 4.4)

2) compilation and output of false

A variable defined at class level will always be given a default value and the default value for the primitive type boolean is false

http://www.jchq.net/tutorial/04_04Tut.htm


--------------------------------------------------------------------------------

Answer to Question 59)

Objective 4.6)

1) The x,y coordinates of an instance of MouseEvent can be obtained using the getX() and getY() methods
4) The time of a MouseEvent can be extracted using the when parameter of the MouseEvent constructor

If you chose option 4, referring to the mythical getTime method you have mad

上一页101112下一页

视频学习

我考网版权与免责声明

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

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

最近更新

社区交流

考试问答