单选题What is the result( )?A The program prints “0”.B The program prints “4”.C The program prints “8”.D The program prints “12”.E The code does not compile.
单选题
What is the result( )?
A
The program prints “0”.
B
The program prints “4”.
C
The program prints “8”.
D
The program prints “12”.
E
The code does not compile.
参考解析
解析:
暂无解析
相关考题:
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?() A、 An exception is thrown.B、 The code will not compile.C、 The program prints “null”D、 The program prints “blue”E、 The program prints “green”
public class foo { public static void main (stringargs) try {return;} finally {system.out.printIn(“Finally”);} } What is the result?() A、 The program runs and prints nothing.B、 The program runs and prints “Finally”C、 The code compiles, but an exception is thrown at runtime.D、 The code will not compile because the catch block is missing.
1. public class X { 2. public static void main (String[]args) { 3. int [] a = new int [1] 4. modify(a); 5. System.out.printIn(a[0]); 6. } 7. 8. public static void modify (int[] a) { 9. a[0] ++; 10. } 11. } What is the result?()A、 The program runs and prints “0”B、 The program runs and prints “1”C、 The program runs but aborts with an exception.D、 An error “possible undefined variable” at line 4 causes compilation to fail.E、 An error “possible undefined variable” at line 9 causes compilation to fail.
1. public class ForBar { 2. public static void main(String []args) { 3. int i = 0, j = 5; 4. tp: for (;;) { 5. i ++; 6. for(;;) 7. if(i --j) break tp; 8. } 9. system.out.printIn(“i = ” + i + “, j = “+ j); 10. } 11. } What is the result?() A、 The program runs and prints “i=1, j=0”B、 The program runs and prints “i=1, j=4”C、 The program runs and prints “i=3, j=4”D、 The program runs and prints “i=3, j=0”E、 An error at line 4 causes compilation to fail.F、 An error at line 7 causes compilation to fail.
public class foo { public static void main (string[]args) try {return;} finally {system.out.printIn(“Finally”);} } What is the result?()A、 The program runs and prints nothing.B、 The program runs and prints “Finally”C、 The code compiles, but an exception is thrown at runtime.D、 The code will not compile because the catch block is missing.
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?() A、 The program runs and prints “0”B、 The program runs and prints “1”C、 The program runs but aborts with an exception.D、 An error “possible undefined variable” at line 4 causes compilation to fail.E、 An error “possible undefined variable” at line 9 causes compilation to fail.
public class ForBar { public static void main(String args) { int i = 0, j = 5; tp: for (;;) { i ++; for(;;) if(i --j) break tp; } system.out.printIn(“i = ” + i + “, j = “+ j); } } What is the result? () A、 The program runs and prints “i=1, j=0”B、 The program runs and prints “i=1, j=4”C、 The program runs and prints “i=3, j=4”D、 The program runs and prints “i=3, j=0”E、 An error at line 4 causes compilation to fail.F、 An error at line 7 causes compilation to fail.
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? () A、 The program runs and prints nothing.B、 The program runs and prints “Equal”C、 An error at line 5 causes compilation to fail.D、 The program runs but aborts with an exception.
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?() A、 The program runs and prints “Hello”B、 An error causes compilation to fail.C、 The program runs and prints “Hello world!”D、 The program runs but aborts with an exception.
public class test ( private static int j = 0; private static boolean methodB(int k) ( j += k; return true; ) public static void methodA(int i)( boolean b: b = i 10 | methodB (4); b = i 10 || methodB (8); ) public static void main (String args[])( methodA (0); system.out.printIn(j); ) ) What is the result?() A、 The program prints “0”B、 The program prints “4”C、 The program prints “8”D、 The program prints “12”E、 The code does not complete.
public class Test { public static void replaceJ(string text) { text.replace (‘j’, ‘l’); } public static void main(String args[]) { string text = new String (“java”) replaceJ(text); system.out.printIn(text); } } What is the result?() A、 The program prints “lava”B、 The program prints “java”C、 An error at line 7 causes compilation to fail.D、 Compilation succeeds but the program throws an exception.
public class test { public static void add3 (Integer i){ int val = i.intValue ( ); val += 3; i = new Integer (val); } public static void main (String args [ ] ) { Integer i = new Integer (0); add3 (i); system.out.printIn (i.intValue ( ) ); } } What is the result?()A、 Compilation will fail.B、 The program prints “0”.C、 The program prints “3”.D、 Compilation will succeed but an exception will be thrown at line 3.
Given 1. public class Foo { 2. public static void main (String [] args) } 3. try { return;} 4. finally { Syste.out.printIn (“Finally”);} 5. } 6. } What is the result( )?A、 The program runs and prints nothing.B、 The program runs and prints “Finally”.C、 The code comiles. But an exception is thrown at runtime.D、 The code will not compile because the catch block is missing.
单选题1. public class X { 2. public static void main (String[]args) { 3. int [] a = new int [1] 4. modify(a); 5. System.out.printIn(a[0]); 6. } 7. 8. public static void modify (int[] a) { 9. a[0] ++; 10. } 11. } What is the result?()A The program runs and prints “0”B The program runs and prints “1”C The program runs but aborts with an exception.D An error “possible undefined variable” at line 4 causes compilation to fail.E An error “possible undefined variable” at line 9 causes compilation to fail.
单选题public class ForBar { public static void main(String args) { int i = 0, j = 5; tp: for (;;) { i ++; for(;;) if(i --j) break tp; } system.out.printIn(“i = ” + i + “, j = “+ j); } } What is the result? ()A The program runs and prints “i=1, j=0”B The program runs and prints “i=1, j=4”C The program runs and prints “i=3, j=4”D The program runs and prints “i=3, j=0”E An error at line 4 causes compilation to fail.F An error at line 7 causes compilation to fail.
单选题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? ()A The program runs and prints nothing.B The program runs and prints “Equal”C An error at line 5 causes compilation to fail.D The program runs but aborts with an exception.
单选题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?()A The program runs and prints nothing.B The program runs and prints “Equal”C An error at line 5 causes compilation to fail.D The program runs but aborts with an exception.
单选题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?()AThe program runs and prints “Hello”BAn error causes compilation to fail.CThe program runs and prints “Hello world!”DThe program runs but aborts with an exception.
单选题1. public class ForBar { 2. public static void main(String []args) { 3. int i = 0, j = 5; 4. tp: for (;;) { 5. i ++; 6. for(;;) 7. if(i --j) break tp; 8. } 9. system.out.printIn(“i = ” + i + “, j = “+ j); 10. } 11. } What is the result?()A The program runs and prints “i=1, j=0”B The program runs and prints “i=1, j=4”C The program runs and prints “i=3, j=4”D The program runs and prints “i=3, j=0”E An error at line 4 causes compilation to fail.F An error at line 7 causes compilation to fail.
单选题What is the result?()A The program runs and prints nothing.B The program runs and prints “Equal”.C An error at line 5 cause compilation to fail.D The program runs but aborts with an exception.
单选题public class foo { public static void main (string[]args) try {return;} finally {system.out.printIn(“Finally”);} } What is the result?()A The program runs and prints nothing.B The program runs and prints “Finally”C The code compiles, but an exception is thrown at runtime.D The code will not compile because the catch block is missing.
单选题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?()A An exception is thrown.B The code will not compile.C The program prints “null”D The program prints “blue”E The program prints “green”
单选题Given 1. public class Foo { 2. public static void main (String [] args) } 3. try { return;} 4. finally { Syste.out.printIn (“Finally”);} 5. } 6. } What is the result( )?A The program runs and prints nothing.B The program runs and prints “Finally”.C The code comiles. But an exception is thrown at runtime.D The code will not compile because the catch block is missing.
单选题What is the result()?A The program runs and prints “ I = 1 , j = 0”B The program runs and prints “ I = 1 , j = 4”C The program runs and prints “ I = 3 , j = 4”D The program runs and prints “ I = 3 , j = 0”E An error at line 4 cause compilation to fail.F An error at line 7 cause compilation to fail.
单选题public class test ( private static int j = 0; private static boolean methodB(int k) ( j += k; return true; ) public static void methodA(int i)( boolean b: b = i 10 | methodB (4); b = i 10 || methodB (8); ) public static void main (String args[])( methodA (0); system.out.printIn(j); ) ) What is the result?()A The program prints “0”B The program prints “4”C The program prints “8”D The program prints “12”E The code does not complete.
单选题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?()A The program runs and prints “0”B The program runs and prints “1”C The program runs but aborts with an exception.D An error “possible undefined variable” at line 4 causes compilation to fail.E An error “possible undefined variable” at line 9 causes compilation to fail.
单选题public class Test { public static void replaceJ(string text) { text.replace (‘j’, ‘l’); } public static void main(String args[]) { string text = new String (“java”) replaceJ(text); system.out.printIn(text); } } What is the result?()A The program prints “lava”B The program prints “java”C An error at line 7 causes compilation to fail.D Compilation succeeds but the program throws an exception.