格林模拟试题三参考答案(4)Java认证考试
文章作者 100test 发表时间 2009:04:10 01:41:24
来源 100Test.Com百考试题网
answer to question 39)
4) the code will compile without error
there are no restrictions on the level of nesting for inner/nested classes. inner classes may be marked private. the main method is not declared as public static void main, and assuming that the commandline was java droitwich it would not be invoked anyway.
answer to question 40)
1) super.oak=1.
2) oak=33.
3) base.oak=22.
because the variable oak is declared as static only one copy of it will exist. thus it can be changed either through the name of its class or through the name of any instance of that class. because it is created as an integer it canot be assigned a fractional component without a cast.
answer to question 41)
obje question 41)
4) use the gettext method of a textfield and use the parseint method of the integer class
here is an example of how you might do this
integer.parseint(txtinputvalue.gettext()).
i m not sure that a question on this actually will come up in the exam but it is a very useful thing to know in the real world.
answer to question 42)
4) none of the above
the wrapper classes are immutable. once the value has been set it cannot be changed. a common use of the wrapper classes is to take advantage of their static methods such as integer.parseint(string s) that will returns an integer if the the value has been set it cannot be changed. a common use of the wrapper classes is to take advantage of their static methods such as integer.parseint(string s) that will returns an integer if the string contains one.