JAVA题库:格林模拟试题二(上)

文章作者 100test 发表时间 2007:03:10 18:30:52
来源 100Test.Com百考试题网


Question 1)
What will happen when you attempt to compile and run this code?
abstract class Base{ abstract public void myfunc(). public void another(){ System.out.println("Another method"). }}public class Abs extends Base{ public static void main(String argv[]){ Abs a = new Abs(). a.amethod(). } public void myfunc(){ System.out.println("My Func"). } public void amethod(){ myfunc(). }}
1) The code will compile and run, printing out the words "My Func"
2) The compiler will complain that the Base class has non abstract methods
3) The code will compile but complain at run time that the Base class has non abstract methods
4) The compiler will complain that the method myfunc in the base class has no body, nobody at all to looove it

Question 2)
What will happen when you attempt to compile and run this code?
public class MyMain{public static void main(String argv){ System.out.println("Hello cruel world"). }}
1) The compiler will complain that main is a reserved word and cannot be used for a class
2) The code will compile and when run will print out "Hello cruel world"
3) The code will compile but will complain at run time that no constructor is defined
4) The code will compile but will complain at run time that main is not correctly defined

Question 3)
Which of the following are Java modifiers?

1) public
2) private
3) friendly
4) transient
5) vagrant

相关文章


07年4月等级考试二级JAVA考前密卷(2)
计算机二级考试VisualBasic常用算法汇总
JAVA题库:格林模拟试题二(上)
07年4月等级考试二级JAVA考前密卷(1)
澳大利亚华人论坛
考好网
日本华人论坛
华人移民留学论坛
英国华人论坛