The program runs and prints “Hello”
An error causes compilation to fail.
The program runs and prints “Hello world!”
The program runs but aborts with an exception.
第1题:
下列语句输出结果为( )。 public class test { public static void main(StringArgsl[]) { String s1=new String("How"); String s2=new String("How"); System.out.println(!(s1==s2)); } }
A.false
B.true
C.1
D.0
第2题:
public class foo { public static void main (Stringargs) { String s; system.out.printIn (“s=” + s); } } What is the result?()
第3题:
interface DeclareStuff{ public static final int EASY = 3; void doStuff(int t); } public class TestDeclare implements DeclareStuff { public static void main(String [] args) { int x=5; new TestDeclare().doStuff(++x); } void doStuff(int s) { s += EASY + ++s; System.out.println(”s “ + s); } } What is the result?()
第4题:
Given: 310-025 Leading the way in IT testing and certification tools, www.testking.com - 48 - public class foo { static String s; public static void main (Stringargs) { system.out.printIn (“s=” + s); } } What is the result?()
第5题:
public class foo { static String s; public static void main (String[]args) { system.out.printIn (“s=” + s); } } What is the result?()
第6题:
public class X { public static void main (String[]args) { String s1 = new String (“true”); Boolean b1 = new Boolean (true); if (s2.equals(b1)) { System.out.printIn(“Equal”); } } } What is the result?()
第7题:
public class X { public static void main (Stringargs) { string s = new string (“Hello”); modify(s); System.out.printIn(s); } public static void modify (String s) { s += “world!”; } } What is the result?()
第8题:
The program runs and prints nothing.
The program runs and prints “Equal”
An error at line 5 causes compilation to fail.
The program runs but aborts with an exception.
第9题:
The program runs and prints “Hello”
An error causes compilation to fail.
The program runs and prints “Hello world!”
The program runs but aborts with an exception.
第10题:
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.
第11题:
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.
第12题:
The program runs and prints “0”
The program runs and prints “1”
The program runs but aborts with an exception.
An error “possible undefined variable” at line 4 causes compilation to fail.
An error “possible undefined variable” at line 9 causes compilation to fail.
第13题:
下列代码的执行结果是______。 public class ex55 { public static void main(String args[] ) { String s1=new String("hello"); String s2=new String("hello"); System.out.print (s1==s2); System.out.print (","); System.out.println (s1.equals (s2)); } }
A.true, false
B.true, true
C.false, true
D.false, false
第14题:
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?()
第15题:
public class X { public static void main (Stringargs) { int a = new int [1] modify(a); System.out.printIn(a[0]); } public static void modify (int a) { a[0] ++; } } What is the result?()
第16题:
public class foo { public static void main (String[]args) { String s; system.out.printIn (“s=” + s); } } What is the result?()
第17题:
public class X { public static void main (Stringargs) { String s1 = new String (“true”); Boolean b1 = new Boolean (true); if (s2.equals(b1)) { System.out.printIn(“Equal”); } } } What is the result? ()
第18题:
public class X { public static void main (String[]args) { string s = new string (“Hello”); modify(s); System.out.printIn(s); } public static void modify (String s) { s += “world!”; } } What is the result?()
第19题:
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.
第20题:
The program runs and prints nothing.
The program runs and prints “Equal”
An error at line 5 causes compilation to fail.
The program runs but aborts with an exception.
第21题:
The program runs and prints “Hello”
An error causes compilation to fail.
The program runs and prints “Hello world!”
The program runs but aborts with an exception.
第22题:
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.
第23题:
s 14
s 16
s 10
Compilation fails.
An exception is thrown at runtime.
第24题:
foofoofoofoofoo
foobarfoobarbar
foobarfoofoofoo
foobarfoobarfoo
barbarbarbarbar
foofoofoobarbar
foofoofoobarfoo