网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
单选题
Click the Exhibit button. 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.
参考答案
参考解析
解析:
暂无解析
更多 “单选题Click the Exhibit button. 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.” 相关考题
考题
Click the Exhibit button. 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
考题
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.
考题
public class SomeException { } Class a: public class a { public void doSomething() { } } Class b: public class b extends a { public void doSomething() throws SomeException { } } Which is true about the two classes?() A、 Compilation of both classes will fail.B、 Compilation of both classes will succeed.C、 Compilation of class a will fail. Compilation of class b will succeed.D、 Compilation of class a will fail. Compilation of class a will succeed.
考题
class A { public String toString () { return “4”; } } class B extends A { 8. public String toString () { return super.toString() + “3”; } } public class Test { public static void main(Stringargs) { System.out.printIn(new B()); } } What is the result?() A、 Compilation succeeds and 4 is printed.B、 Compilation succeeds and 43 is printed.C、 An error on line 9 causes compilation to fail.D、 An error on line 14 causes compilation to fail.E、 Compilation succeeds but an exception is thrown at line 9.
考题
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.
考题
abstract class abstrctIt { abstract float getFloat (); } public class AbstractTest extends AbstractIt { private float f1= 1.0f; private float getFloat () {return f1;} } What is the result? ()A、 Compilation is successful.B、 An error on line 6 causes a runtime failure.C、 An error at line 6 causes compilation to fail.D、 An error at line 2 causes compilation to fail.
考题
1. class SuperClass { 2. public a geta() { 3. return new a(); 4. } 5. } 6. class SubClass extends SuperClass { 7. public b geta() { 8. return new b(); 9. } 10. } Which is true?() A、 Compilation will succeed if a extends b.B、 Compilation will succeed if b extends a.C、 Compilation will always fail because of an error in line 7.D、 Compilation will always fail because of an error in line 8.
考题
package foo; import java.util.Vector; private class MyVector extends Vector { int i = 1; public MyVector() { i = 2; } } public class MyNewVector extends MyVector { public MyNewVector() { i = 4; } public static void main(String args[]) { MyVector v = new MyNewVector(); } } What is the result?()A、 Compilation succeeds.B、 Compilation fails because of an error at line 5.C、 Compilation fails because of an error at line 6.D、 Compilation fails because of an error at line 14.E、 Compilation fails because of an error at line 17.
考题
public class X { public static void main (String[] args) { byte b = 127; byte c = 126; byte d = b + c; } } Which statement is true?() A、 Compilation succeeds and d takes the value 253.B、 Line 5 contains an error that prevents compilation.C、 Line 5 throws an exception indicating “Out of range”D、 Line 3 and 4 contain error that prevent compilation.E、 The compilation succeeds and d takes the value of 1.
考题
package foo; import java.util.Vector; private class MyVector extends Vector { int i = 1; public MyVector() { i = 2; } } public class MyNewVector extends MyVector { public MyNewVector () { i = 4; } public static void main (String args ) { MyVector v = new MyNewVector(); } } The file MyNewVector.java is shown in the exhibit. What is the result?()A、 Compilation will succeed.B、 Compilation will fail at line 5.C、 Compilation will fail at line 6.D、 Compilation will fail at line 14.E、 Compilation will fail at line 17.
考题
class A { public int getNumber(int a) { return a + 1; } } class B extends A { public int getNumber (int a) { return a + 2 } public static void main (String args) { A a = new B(); System.out.printIn(a.getNumber(0)); } } What is the result? () A、 Compilation succeeds and 1 is printed.B、 Compilation succeeds and 2 is printed.C、 An error at line 8 causes compilation to fail.D、 An error at line 13 causes compilation to fail.E、 An error at line 14 causes compilation to fail.
考题
interface foo { int k = 0; } public class test implements Foo ( public static void main(String args) ( int i; Test test = new test (); i= test.k; i= Test.k; i= Foo.k; ) ) What is the result? ()A、 Compilation succeeds.B、 An error at line 2 causes compilation to fail.C、 An error at line 9 causes compilation to fail.D、 An error at line 10 causes compilation to fail.E、 An error at line 11 causes compilation to fail.
考题
单选题public class Test { public static void main (String args) { class Foo { public int i = 3; } Object o = (Object) new Foo(); Foo foo = (Foo)o; System.out.printIn(foo. i); } } What is the result?()A
Compilation will fail.B
Compilation will succeed and the program will print “3”C
Compilation will succeed but the program will throw a ClassCastException at line 6.D
Compilation will succeed but the program will throw a ClassCastException at line 7.
考题
单选题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.
考题
单选题interface foo { int k = 0; } public class test implements Foo ( public static void main(String args) ( int i; Test test = new test (); i= test.k; i= Test.k; i= Foo.k; ) ) What is the result? ()A
Compilation succeeds.B
An error at line 2 causes compilation to fail.C
An error at line 9 causes compilation to fail.D
An error at line 10 causes compilation to fail.E
An error at line 11 causes compilation to fail.
考题
单选题abstract class abstrctIt { abstract float getFloat (); } public class AbstractTest extends AbstractIt { private float f1= 1.0f; private float getFloat () {return f1;} } What is the result?()A
Compilation is successful.B
An error on line 6 causes a runtime failure.C
An error at line 6 causes compilation to fail.D
An error at line 2 causes compilation to fail.
考题
单选题1. class SuperClass { 2. public a geta() { 3. return new a(); 4. } 5. } 6. class SubClass extends SuperClass { 7. public b geta() { 8. return new b(); 9. } 10. } Which is true?()A
Compilation will succeed if a extends b.B
Compilation will succeed if b extends a.C
Compilation will always fail because of an error in line 7.D
Compilation will always fail because of an error in line 8.
考题
单选题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.
考题
单选题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
Compilation fails because of an error on line 28.E
A runtime error occurs when line 25 executes.
考题
单选题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.
考题
单选题public class X { public static void main (String args) { byte b = 127; byte c = 126; byte d = b + c; } } Which statement is true?()A
Compilation succeeds and d takes the value 253.B
Line 5 contains an error that prevents compilation.C
Line 5 throws an exception indicating “Out of range”D
Line 3 and 4 contain error that prevent compilation.E
The compilation succeeds and d takes the value of 1.
考题
单选题package foo; import java.util.Vector; private class MyVector extends Vector { int i = 1; public MyVector() { i = 2; } } public class MyNewVector extends MyVector { public MyNewVector() { i = 4; } public static void main(String args[]) { MyVector v = new MyNewVector(); } } What is the result?()A
Compilation succeeds.B
Compilation fails because of an error at line 5.C
Compilation fails because of an error at line 6.D
Compilation fails because of an error at line 14.E
Compilation fails because of an error at line 17.
考题
单选题Click the Exhibit button. 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.
考题
单选题class A { public int getNumber(int a) { return a + 1; } } class B extends A { public int getNumber (int a) { return a + 2 } public static void main (String args) { A a = new B(); System.out.printIn(a.getNumber(0)); } } What is the result? ()A
Compilation succeeds and 1 is printed.B
Compilation succeeds and 2 is printed.C
An error at line 8 causes compilation to fail.D
An error at line 13 causes compilation to fail.E
An error at line 14 causes compilation to fail.
考题
单选题public class SomeException { } Class a: public class a { public void doSomething() { } } Class b: public class b extends a { public void doSomething() throws SomeException { } } Which is true about the two classes?()A
Compilation of both classes will fail.B
Compilation of both classes will succeed.C
Compilation of class a will fail. Compilation of class b will succeed.D
Compilation of class a will fail. Compilation of class a will succeed.
考题
单选题package foo; import java.util.Vector; private class MyVector extends Vector { int i = 1; public MyVector() { i = 2; } } public class MyNewVector extends MyVector { public MyNewVector () { i = 4; } public static void main (String args ) { MyVector v = new MyNewVector(); } } The file MyNewVector.java is shown in the exhibit. What is the result?()A
Compilation will succeed.B
Compilation will fail at line 5.C
Compilation will fail at line 6.D
Compilation will fail at line 14.E
Compilation will fail at line 17.
考题
单选题class A { public String toString () { return “4”; } } class B extends A { 8. public String toString () { return super.toString() + “3”; } } public class Test { public static void main(Stringargs) { System.out.printIn(new B()); } } What is the result?()A
Compilation succeeds and 4 is printed.B
Compilation succeeds and 43 is printed.C
An error on line 9 causes compilation to fail.D
An error on line 14 causes compilation to fail.E
Compilation succeeds but an exception is thrown at line 9.
热门标签
最新试卷