网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
单选题
1.public classA{ 2.public String doit(intx,inty){ 3.return"a"; 4.} 5. 6.public String doit(int...vals){ 7.return"b"; 8.} 9.} And: 25.A a=new A(); 26.System.out.println(a.doit(4,5)); What is the result?()
A
Line 26 prints a to System.out.
B
Line 26 prints b to System.out.
C
An exception is thrown at line 26 at runtime.
D
Compilation of class A will fail due to an error in line 6.
参考答案
参考解析
解析:
暂无解析
更多 “单选题1.public classA{ 2.public String doit(intx,inty){ 3.return"a"; 4.} 5. 6.public String doit(int...vals){ 7.return"b"; 8.} 9.} And: 25.A a=new A(); 26.System.out.println(a.doit(4,5)); What is the result?()A Line 26 prints a to System.out.B Line 26 prints b to System.out.C An exception is thrown at line 26 at runtime.D Compilation of class A will fail due to an error in line 6.” 相关考题
考题
1.public classA{2.public String doit(intx,inty){3.returna;4.}5.6.public String doit(int...vals){7.returnb;8.}9.}And:25.A a=new A();26.System.out.println(a.doit(4,5));What is the result?()A.Line 26 prints a to System.out.B.Line 26 prints b to System.out.C.An exception is thrown at line 26 at runtime.D.Compilation of class A will fail due to an error in line 6.
考题
publicclassA{2.publicStringdoit(intx,inty){3.returna”;4.}5.6.publicStringdoit(int...vals){7.returnb”;8.}9.}Given:25.Aa=newA();26.System.out.println(a.doit(4,5));Whatistheresult?()
A.Line26prints“a”toSystem.out.B.Line26prints?b”toSystem.out.C.Anexceptionisthrownatline26atruntime.D.CompilationofclassAwillfailduetoanerrorinline6.
考题
Click the Exhibit button.Given:What is the result?()
A.Line 26 prints a to System.out.B.Line 26 prints b to System.out.C.An exception is thrown at line 26 at runtime.D.Compilation of class A will fail due to an error in line 6.
考题
1. public interface A { 2. public void doSomething(String thing); 3. } 1. public class AImpl implements A { 2. public void doSomething(String msg) { } 3. } 1. public class B { 2. public A doit() { 3. // more code here 4. } 5. 6. public String execute() { 7. // more code here 8. } 9. } 1. public class C extends B { 2. public AImpl doit() { 3. // more code here 4. } 5. 6. public Object execute() { 7. // more code here 8. } 9. } Which statement is true about the classes and interfaces in the exhibit?() A、 Compilation will succeed for all classes and interfaces.B、 Compilation of class C will fail because of an error in line 2.C、 Compilation of class C will fail because of an error in line 6.D、 Compilation of class AImpl will fail because of an error in line 2.
考题
1.public classA{ 2.public String doit(intx,inty){ 3.return"a"; 4.} 5. 6.public String doit(int...vals){ 7.return"b"; 8.} 9.} And: 25.A a=new A(); 26.System.out.println(a.doit(4,5)); What is the result?()A、Line 26 prints "a" to System.out.B、Line 26 prints "b" to System.out.C、An exception is thrown at line 26 at runtime.D、Compilation of class A will fail due to an error in line 6.
考题
1. public class A { 2. public void doit() { 3. } 4. public String doit() { 5. return “a”; 6. } 7. public double doit(int x) { 8. return 1.0; 9. } 10.} What is the result?() A、 An exception is thrown at runtime.B、 Compilation fails because of an error in line 7.C、 Compilation fails because of an error in line 4.D、 Compilation succeeds and no runtime errors with class A occur.
考题
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 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 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.
考题
1. public class ArrayTest { 2. public static void main (String[]args) { 3. float f1[], f2[]; 4. f1 = new float [10]; 5. f2 = f1; 6. System.out.printIn (“f2[0]=” + f2[0]); 7. } 8. } What is the result?() A、 It prints f2[0] = 0.0B、 It prints f2[0] = NaNC、 An error at line 5 causes compile to fail.D、 An error at line 6 causes compile to fail.E、 An error at line 6 causes an exception at runtime.
考题
1. public class A { 2. 3. private int counter = 0; 4. 5. public static int getInstanceCount() { 6. return counter; 7. } 8. 9. public A() { 10. counter++; 11. } 12. 13. } Given this code from Class B: 25.A a1 =new A(); 26. A a2 =new A(); 27. A a3 =new A(); 28. System.out.printIn(A.getInstanceCount() ); What is the result?() A、 Compilation of class A fails.B、 Line 28 prints the value 3 to System.out.C、 Line 28 prints the value 1 to System.out.D、 A runtime error occurs when line 25 executes.E、 Compilation fails because of an error on line 28.
考题
1. public class A { 2. public String doit(int x, int y) { 3. return “a”; 4. } 5. 6. public String doit(int... vals) { 7. return “b”; 8. } 9. } Given: 25. A a=new A(); 26. System.out.println(a.doit(4, 5)); What is the result?() A、 Line 26 prints “a” to System.out.B、 Line 26 prints „b” to System.out.C、 An exception is thrown at line 26 at runtime.D、 Compilation of class A will fail due to an error in line 6.
考题
单选题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 interface A { 2. public void doSomething(String thing); 3. } 1. public class AImpl implements A { 2. public void doSomething(String msg) { } 3. } 1. public class B { 2. public A doit() { 3. // more code here 4. } 5. 6. public String execute() { 7. // more code here 8. } 9. } 1. public class C extends B { 2. public AImpl doit() { 3. // more code here 4. } 5. 6. public Object execute() { 7. // more code here 8. } 9. } Which statement is true about the classes and interfaces in the exhibit?()A
Compilation will succeed for all classes and interfaces.B
Compilation of class C will fail because of an error in line 2.C
Compilation of class C will fail because of an error in line 6.D
Compilation of class AImpl will fail because of an error in line 2.
考题
单选题1. public class A { 2. public String doit(int x, int y) { 3. return “a”; 4. } 5. 6. public String doit(int... vals) { 7. return “b”; 8. } 9. } Given: 25. A a=new A(); 26. System.out.println(a.doit(4, 5)); What is the result?()A
Line 26 prints “a” to System.out.B
Line 26 prints „b” to System.out.C
An exception is thrown at line 26 at runtime.D
Compilation of class A will fail due to an error in line 6.
考题
单选题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.
考题
单选题1.public classA{ 2.public String doit(intx,inty){ 3.return"a"; 4.} 5. 6.public String doit(int...vals){ 7.return"b"; 8.} 9.} And: 25.A a=new A(); 26.System.out.println(a.doit(4,5)); What is the result?()A
Line 26 prints a to System.out.B
Line 26 prints b to System.out.C
An exception is thrown at line 26 at runtime.D
Compilation of class A will fail due to an error in line 6.
考题
单选题Click the Exhibit button. Given this code from Class B: 25.A a1 = new A(); 26.A a2 = new A(); 27.A a3 = new A(); 28.System.out.println(A.getInstanceCount()); What is the result?()A
Compilation of class A fails.B
Line 28 prints the value 3 to System.out.C
Line 28 prints the value 1 to System.out.D
A runtime error occurs when line 25 executes.E
Compilation fails because of an error on line 28.
考题
单选题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.
考题
单选题1. public class ArrayTest { 2. public static void main (String[]args) { 3. float f1[], f2[]; 4. f1 = new float [10]; 5. f2 = f1; 6. System.out.printIn (“f2[0]=” + f2[0]); 7. } 8. } What is the result?()A
It prints f2[0] = 0.0B
It prints f2[0] = NaNC
An error at line 5 causes compile to fail.D
An error at line 6 causes compile to fail.E
An error at line 6 causes an exception at runtime.
考题
单选题Click the Exhibit button. What is the result?()A
Line 26 prints "a" to System.out.B
Line 26 prints "b" to System.out.C
An exception is thrown at line 26 at runtime.D
Compilation of class A will fail due to an error in line 6.
考题
单选题1. interface TestA { String toString(); } 2. public class Test { 3. public static void main(String[] args) { 4. System.out.println(new TestA() { 5. public String toString() { return “test”; } 6. } 7. } 8. } What is the result?()A
testB
nullC
An exception is thrown at runtime.D
Compilation fails because of an error in line 1.E
Compilation fails because of an error in line 4.F
Compilation fails because of an error in line 5.
考题
单选题1. public class A { 2. 3. private int counter = 0; 4. 5. public static int getInstanceCount() { 6. return counter; 7. } 8. 9. public A() { 10. counter++; 11. } 12. 13. } Given this code from Class B: 25.A a1 =new A(); 26. A a2 =new A(); 27. A a3 =new A(); 28. System.out.printIn(A.getInstanceCount() ); What is the result?()A
Compilation of class A fails.B
Line 28 prints the value 3 to System.out.C
Line 28 prints the value 1 to System.out.D
A runtime error occurs when line 25 executes.E
Compilation fails because of an error on line 28.
考题
单选题1. public class A { 2. public void doit() { 3. } 4. public String doit() { 5. return “a”; 6. } 7. public double doit(int x) { 8. return 1.0; 9. } 10.} What is the result?()A
An exception is thrown at runtime.B
Compilation fails because of an error in line 7.C
Compilation fails because of an error in line 4.D
Compilation succeeds and no runtime errors with class A occur.
考题
单选题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.
热门标签
最新试卷