网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)
单选题
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 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.” 相关考题
考题 以下Java应用程序执行入口main方法的声明中,正确的是( )。 A.public static void main()B.public static void main(String[] args)C.public static int main(String[] args)D.public void main(String[] args)

考题 public class Something {void doSomething () {private String s = "";int l = s.length();}}有错吗?

考题 public class Something {public static void main(String[] args) {Something s = new Something();System.out.println("s.doSomething() returns " + doSomething());}public String doSomething() {return "Do something ...";}}看上去很完美。

考题 interface A{int x = 0;}class B{int x =1;}class C extends B implements A {public void pX(){System.out.println(x);}public static void main(String[] args) {new C().pX();}}

考题 interface Playable {void play();}interface Bounceable {void play();}interface Rollable extends Playable, Bounceable {Ball ball = new Ball("PingPang");}class Ball implements Rollable {private String name;public String getName() {return name;}public Ball(String name) {this.name = name;}public void play() {ball = new Ball("Football");System.out.println(ball.getName());}}这个错误不容易发现。

考题 以下哪个是Java应用程序main方法的有效定义? 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[] );

考题 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.

考题 以下是JAVA中正确的入口方法是? () A、 public static void main(String[] args){}B、 public static void main(String args){}C、 public void main(String[] args){}D、 public static int main(String[] args){}

考题 public interface A {  String DEFAULT_GREETING = “Hello World”;  public void method1();  }  A programmer wants to create an interface called B that has A as its parent. Which interface declaration is correct?() A、 public interface B extends A {}B、 public interface B implements A {}C、 public interface B instanceOf A {}D、 public interface B inheritsFrom A {}

考题 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.

考题 Which declarations will allow a class to be started as a standalone program?()  A、public void main(String args[])B、public void static main(String args[])C、public static main(String[] argv)D、final public static void main(String [] array)E、public static void main(String args[])

考题 Which two allow the class Thing to be instantiated using new Thing()?A、 public class Thing { }B、 public class Thing { public Thing() {} }C、 public class Thing { public Thing(void) {} }D、 public class Thing { public Thing(String s) {} }E、 public class Thing { public void Thing() {} public Thing(String s) {} }

考题 下列有关main()方法的签名正确的是哪些?()A、 public static void main(String[] args){}B、 public static void main(){}C、 public static void main(String args[]){}D、 public void static main(String[] args){}

考题 作为Java应用程序入口的main方法,其声明格式可以是()。A、public static void main(String[] args)B、public static int main(String[] args)C、public void main(String[] args)D、public int main(String[] args)

考题 声明Java独立应用程序main()方法时,正确表达是()。A、public static void main(String[]args){…}B、private static void main(String args[]){…}C、public void main(String args[]){…}D、public static void main(){…}

考题 在J2EE中,以下是firePropertyChange的原型,正确的是()。 A、public void firePropertyChange(PropertyChangeListener l,String oldValue, String newValue)B、public void firePropertyChange(String propertyName, Object oldValue, Object newValue)C、public void firePropertyChange(PropertyChangeSupport changes)D、public void firePropertyChange(Object oldValue, Object newValue)

考题 下列代码正确的是哪项?() A、 public class Session implements Runnable, Clonable{   public void run ();public Object clone () ; }B、 public class Session extends Runnable, Cloneable {  public void run() {/*dosomething*/}       public Object clone() {/*make a copy*/} }C、 public abstract class Session implements Runnable, Clonable {       public void run() {/*do something*/}       public Object clone() {/*make a copy*/}        }D、 public class Session implements Runnable, implements Clonable {       public void run() {/*do something*/}       public Object clone() {/*make a copy*/}       }

考题 现有:  interface Data {public void load();}  abstract class Info {public abstract void load();}      下列类定义中正确使用Data和Info的是哪项?() A、 public class Employee implements Info extends Data { public void load(){/*dosomething*/}     }B、public class Employee extends Inf.implements Data{ public void load() {/*do something*/}     }C、public class Empl.yee implements Inf extends Data{ public void Data.1oad(){* do something*/}     public void load(){/*do something*/}     }D、public class Employee extends Inf implements Data  {  public void Data.1oad()  {/*do something*/)     public void info.1oad(){/*do something*/}    }

考题 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.

考题 下面哪些main方法可用于程序执行()A、public static void main(String[]args)B、public static void main(String[]x)C、public static void main(Stringargs[])D、public void main(String[]args)

考题 单选题现有:  interface Data {public void load();}  abstract class Info {public abstract void load();}      下列类定义中正确使用Data和Info的是哪项?()A  public class Employee implements Info extends Data { public void load(){/*dosomething*/}     }B public class Employee extends Inf.implements Data{ public void load() {/*do something*/}     }C public class Empl.yee implements Inf extends Data{ public void Data.1oad(){* do something*/}     public void load(){/*do something*/}     }D public class Employee extends Inf implements Data  {  public void Data.1oad()  {/*do something*/)     public void info.1oad(){/*do something*/}    }

考题 单选题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.

考题 单选题1. public class SimpleCalc {  2. public int value;  3. public void calculate() { value += 7; }  4. } And:  1. public class MultiCalc extends SimpleCalc {  2. public void calculate() { value -= 3; }  3. public void calculate(int multiplier) {  4. calculate();  5. super.calculate();  6. value *=multiplier;  7. }  8. public static void main(String[] args) {  9. MultiCalc calculator = new MultiCalc();  10. calculator.calculate(2);  11. System.out.println(”Value is: “+ calculator.value);  12. }  13. }  What is the result?()A  Value is: 8B  Compilation fails.C  Value is: 12D  Value is: -12E  The code runs with no output.F  An exception is thrown at runtime.

考题 单选题以下是JAVA中正确的入口方法是? ()A  public static void main(String[] args){}B  public static void main(String args){}C  public void main(String[] args){}D  public static int main(String[] args){}

考题 单选题1. interface A { public void aMethod(); }  2. interface B { public void bMethod(); }  3. interface C extends A,B { public void cMethod(); }  4. class D implements B {  5. public void bMethod() { }  6. }  7. class E extends D implements C {  8. public void aMethod() { }  9. public void bMethod() { }  10. public void cMethod() { }  11. }  What is the result?()A  Compilation fails because of an error in line 3.B  Compilation fails because of an error in line 7.C  Compilation fails because of an error in line 9.D  If you define D e = new E(), then e.bMethod() invokes the version of bMethod()defined in Line 5.E  If you define D e = (D)(new E()),then e.bMethod() invokes the version of bMethod() defined in Line 5.F  If you define D e = (D)(new E()), then e.bMethod() invokes the version of bMethod() defined in Line 9.

考题 单选题public interface A {  String DEFAULT_GREETING = “Hello World”;  public void method1();  }  A programmer wants to create an interface called B that has A as its parent. Which interface declaration is correct?()A  public interface B extends A {}B  public interface B implements A {}C  public interface B instanceOf A {}D  public interface B inheritsFrom A {}

考题 单选题class Parent {     String one, two;  public Parent(String a, String b){     one = a;     two = b;    }  public void print(){ System.out.println(one); }    }  public class Child extends Parent {     public Child(String a, String b){     super(a,b);     }  public void print(){  System.out.println(one + " to " + two);     }  public static void main(String arg[]){     Parent p = new Parent("south", "north");     Parent t = new Child("east", "west");     p.print();     t.print();     }     }  Which of the following is correct?()A  Cause error during compilation. B  south     east C  south to north     east to west    D  south to north     east    E  south     east to west

考题 单选题1. interface Animal {   2. void eat();   3. }   4.   5. // insert code here   6.   7. public class HouseCat implements Feline {   8. public void eat() { }   9. }   和以下三个接口声明:   interface Feline extends Animal { }   interface Feline extends Animal { void eat(); }   interface Feline extends Animal { void eat() { } }   分别插入到第 5 行,有多少行可以编译?()A 0B 1C 2D 3