public class Alpha{&e

题目

public class Alpha{  public static void main( string[] args ){  if ( args.length == 2 ) {  if ( args.[0].equalsIgnoreCase(“-b”) )  System.out.println( new Boolean( args[1] ));  }  }  }   And the code is invoked by using the command: java Alpha –b TRUE   What is the result?()  

  • A、 true
  • B、 null
  • C、 false
  • D、 Compilation fails.
  • E、 The code runs with no output.
  • F、 An exception is thrown at runtime.
如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

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.

正确答案:D

第2题:

interface Data { public void load(); }  abstract class Info { public abstract void load(); }  Which class correctly uses the Data interface and Info class?() 

  • A、 public class Employee extends Info implements Data { public void load() { /*do something*/ } }
  • B、 public class Employee implements Info extends Data { public void load() { /*do something*/ } }
  • C、 public class Employee extends Info implements Data { public void load() { /*do something */ } public void Info.load() { /*do something*/ } }
  • D、 public class Employee implements Info extends Data { public void Data.load() { /*dsomething */ } public void load() { /*do something */ } }
  • E、 public class Employee implements Info extends Data { public void load() { /*do something */ } public void Info.load(){ /*do something*/ } }
  • F、 public class Employee extends Info implements Data{ public void Data.load() { /*do something*/ } public void Info.load() { /*do something*/ } }

正确答案:A

第3题:

下列程序片段中,能通过编译的是

A.public abstract class Animal{ public void speak();}

B.public abstract class Animal{ public void speak(){}}

C.public class Animal{ public abstract void speak();}

D.public abstract class Animal{ public abstract void speak(){}}


正确答案:A

第4题:

Which two demonstrate an “is a” relationship?()   

  • A、 public interface Person { }  public class Employee extends Person { }
  • B、 public interface Shape { }  public class Employee extends Shape { }
  • C、 public interface Color { }  public class Employee extends Color { }
  • D、 public class Species { }  public class Animal (private Species species;)
  • E、 interface Component { }  Class Container implements Component ( Private Component[ ] children;  )

正确答案:D,E

第5题:

interface Animal {  void soundOff();  }  class Elephant implements Animal {  public void soundOff() {  System.out.println(“Trumpet”);  }  }  class Lion implements Animal {  public void soundOff() { System.out.println(“Roar”);  }  }  class Alpha1 {  static Animal get( String choice ) {  if ( choice.equalsIgnoreCase( “meat eater” )) {  return new Lion();  } else {  return new Elephant();  }  }  }  Which compiles?()  

  • A、 new Animal().soundOff();
  • B、 Elephant e = new Alpha1();
  • C、 Lion 1 = Alpha.get(“meat eater”);
  • D、 new Alpha1().get(“veggie”).soundOff();

正确答案:D

第6题:

Which three demonstrate an “is a” relationship?() 

  • A、 public class X {  }     public class Y extends X { }
  • B、 public interface Shape { }     public interface Rectangle extends Shape{ }
  • C、 public interface Color { }     public class Shape { private Color color; }
  • D、 public interface Species { }     public class Animal { private Species species; }
  • E、 public class Person { }    public class Employee {      public Employee(Person person) { }
  • F、 interface Component { }     class Container implements Component {   private Component[] children; }

正确答案:A,B,F

第7题:

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) {} }

正确答案:A,B

第8题:

Given:Which two, inserted at line 11, will allow the code to compile?()

A.public class MinMax<?> {

B.public class MinMax<? extends Number> {

C.public class MinMax<N extends Object> {

D.public class MinMax<N extends Number> {

E.public class MinMax<? extends Object> {

F.public class MinMax<N extends Integer> {


参考答案:D, F

第9题:

Which the two demonstrate an “is a” relationship?()

  • A、 public interface Person {}  Public class Employee extends Person {}
  • B、 public interface Shape {}  public interface Rectangle extends Shape {}
  • C、 public interface Color {}  public class Shape { private Color color; }
  • D、 public class Species {}  public class Animal { private Species species; }
  • E、 interface Component {} Class Container implements Component {private Component [] children;

正确答案:B,E

第10题:

public class Plant {  private String name;  public Plant(String name) { this.name = name; }  public String getName() { return name; }  }  public class Tree extends Plant {  public void growFruit() { }  public void dropLeaves() { }  }  Which is true?() 

  • A、 The code will compile without changes.
  • B、 The code will compile if public Tree() { Plant(); } is added to the Tree class.
  • C、 The code will compile if public Plant() { Tree(); } is added to the Plant class.
  • D、 The code will compile if public Plant() { this(”fern”); } is added to the Plant class.
  • E、 The code will compile if public Plant() { Plant(”fern”); } is added to the Plant class.

正确答案:D

更多相关问题