The code compiles and “s=” is printed.
The code compiles and “s=null” is printed.
The code does not compile because string s is not initialized.
The code does not compile because string s cannot be referenced.
The code compiles, but a NullPointerException is thrown when toString is called.
第1题:
public class Test { public static void main (String args) { string foo = “blue”; string bar = foo; foo = “green”; System.out.printIn(bar); } } What is the result?()
第2题:
public class Base { public static final String FOO = “foo”; public static void main(String[] args) { Base b = new Base(); Sub s = new Sub(); System.out.print(Base.FOO); System.out.print(Sub.FOO); System.out.print(b.FOO); System.out.print(s.FOO); System.out.print(((Base)s).FOO); } } class Sub extends Base {public static final String FOO=bar;} What is the result?()
第3题:
A. public static void main();
B. public static void main( String args );
C. public static void main( String args[] );
D. public static void main( Graphics g );
E. public static boolean main( String a[] );
第4题:
作为类中新线程的开始点,线程的执行是从()方法开始的。
第5题:
下列有关main()方法的签名正确的是哪些?()
第6题:
Which declarations will allow a class to be started as a standalone program?()
第7题:
public class foo { public static void main (stringargs) try {return;} finally {system.out.printIn(“Finally”);} } What is the result?()
第8题:
public class foo { public static void main (Stringargs) { String s; system.out.printIn (“s=” + s); } } What is the result?()
第9题:
下面关于Java应用程序中main方法的写法,合法的是()。
第10题:
public class Foo { static int[] a; static { a[0]=2; } public static void main( String[] args) {} } Which exception or error will be thrown when a programmer attempts to run this code?()