格林模拟试题二参考答案Java认证考试
文章作者 100test 发表时间 2009:04:10 01:41:31
来源 100Test.Com百考试题网
answer 1)
1) the code will compile and run, printing out the words "my func"
a class that contains an abstract method must be declared abstract itself, but may contain non abstract methods.
answer 2)
4) the code will compile but will complain at run time that main is not correctly defined
in this example the parameter is a string not a string array as needed for the correct main method
answer 3)
1) public
2) private
4) transient
the keyword transient is easy to forget as is not frequently used. although a method may be considered to be friendly like in c it is not a java keyword.
answer 4)
2) the compiler will complain that the base class is not declared as abstract.
if a class contains abstract methods it must itself be declared as abstract
answer 5)
1) to get to access hardware that java does not know about
3) to write optimised code for performance in a language such as c/c
answer 6)
4) success in compilation and output of "amethod" at run time.
a final method cannot be ovverriden in a sub class, but apart from that it does not cause any other restrictions.
answer 7)
4) compilation and execution without error
it would cause a run time error if you had a call to amethod though.