格林模拟试题一参考答案

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

 

answer 9)

3 ) 2

no error will be triggered.

like in c/c++, arrays are always referenced from 0. java allows an array to be populated at creation time. the size of array is taken from the number of initializers. if you put a size within any of the square brackets you will get an error.


answer 10)

3) 0

arrays are always initialised when they are created. as this is an array of ints it will be initalised with zeros.


answer 11)

3) error mine must be declared abstract
 

a class that contains an abstract method must itself be declared as abstract. it may however contain non abstract methods. any class derived from an abstract class must either define all of the abstract methods or be declared abstract itself.


answer 12)

3) one, two, default

code will continue to fall through a case statement until it encounters a break.


answer 13)

2) default, zero

although it is normally placed last the default statement does not have to be the last item as you fall through the case block. because there is no case label found matching the expression the default label is executed and the code continues to fall through until it encounters a break.


answer 14)

2,3

example 1 will not compile because if must always test a boolean. this can catch out c/c++ programmers who expect the test to be for either 0 or not 0.

视频学习

我考网版权与免责声明

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

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

最近更新

社区交流

考试问答