niusouti.com

单选题现有:  public interface A {}   以下哪项声明是合法的?()AA a = new A();BA[] a = new A[];CA[] a = new A[10];D以上皆错

题目
单选题
现有:  public interface A {}   以下哪项声明是合法的?()
A

 A a = new A();

B

 A[] a = new A[];

C

 A[] a = new A[10];

D

 以上皆错


相似考题
更多“现有:  public interface A {}   以下哪项声明是合法的?() ”相关问题
  • 第1题:

    interface 声明一个接口时,成员方法默认的修饰符是()

    A. private

    B. 友好的

    C. abstract

    D. public abstract


    正确答案:D

  • 第2题:

    现有:   public interface A {}   以下哪项声明是合法的?() 

    • A、a = new A();
    • B、 A[] a = new A[];
    • C、 A[] a = new A[10];
    • D、 以上皆错

    正确答案:C

  • 第3题:

    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

  • 第4题:

    以下声明合法的是()

    • A、default  String  s
    • B、public  final  static  native  int  w( )
    • C、abstract  double  d
    • D、abstract  final  double  hyperbolicCosine( )

    正确答案:B

  • 第5题:

    现有:  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*/}    }

    正确答案:B

  • 第6题:

    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

  • 第7题:

    现有:   1. interface Altitude {   2.   //insert code here  3. }    和4个声明:  int HIGH = 7;   public int HIGH = 7;   abstract int HIGH = 7;   interface int HIGH = 7;    分别插入到第2行,有多少行可以编译?()  

    • A、 0
    • B、 1
    • C、 2
    • D、 3
    • E、 4

    正确答案:C

  • 第8题:

    单选题
    现有:  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*/}    }


    正确答案: D
    解析: 暂无解析

  • 第9题:

    单选题
    现有:  1. interface Animal {  2. void eat();  3. }  4.  5. // insert code here  6.  7. public class HouseCat extends Feline {  8. public void eat() { }  9. }   和五个声明:  abstract class Feline implements Animal { }  abstract class Feline implements Animal { void eat(); }  abstract class Feline implements Animal { public void eat(); }  abstract class Feline implements Animal { public void eat() { } }  abstract class Feline implements Animal { abstract public void eat(); }  分别插入到第5行,有几个可以通过编译?()
    A

    0

    B

    1

    C

    2

    D

    3


    正确答案: D
    解析: 暂无解析

  • 第10题:

    单选题
    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 {}


    正确答案: A
    解析: 暂无解析

  • 第11题:

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

    0

    B

    1

    C

    2

    D

    3


    正确答案: C
    解析: 暂无解析

  • 第12题:

    单选题
    现有:   public interface A {}   以下哪项声明是合法的?()
    A

    a = new A();

    B

     A[] a = new A[];

    C

     A[] a = new A[10];

    D

     以上皆错


    正确答案: D
    解析: 暂无解析

  • 第13题:

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

    正确答案:A

  • 第14题:

    现有:  1.  interface Animal  f      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、  0
    • B、  1
    • C、  2
    • D、  3

    正确答案:C

  • 第15题:

    在使用interface声明一个接口时,只可以使用()修饰符修饰该接口。 

    • A、private
    • B、protected
    • C、private  protected
    • D、public

    正确答案:D

  • 第16题:

    main方法是Java程序执行的入口点,关于main方法的方法头以下哪项是合法的()?

    • A、public static void main( )
    • B、public static void main( String args[] )
    • C、public static int main(String [] arg )
    • D、public void main(String arg[] )

    正确答案:B

  • 第17题:

    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

  • 第18题:

    现有      public class Parentt      public void change (int x){)     )      public class Child extends Parent{     //覆盖父类change方法     }      下列哪个声明是正确的覆盖了父类的change方法?()    

    • A、  protected void change (int x){}
    • B、  public void change(int x,  int y){}
    • C、  public void change (int x){}
    • D、  public void change (String s){}

    正确答案:C

  • 第19题:

    多选题
    以下哪些属于DTD声明方式。()
    A

    外部SYSTEM声明

    B

    外部PUBLIC声明

    C

    内部声明

    D

    实体声明


    正确答案: A,C
    解析: 暂无解析

  • 第20题:

    多选题
    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,F
    解析: 暂无解析

  • 第21题:

    多选题
    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,A
    解析: 暂无解析

  • 第22题:

    单选题
    现有:  1.  interface Animal  f      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

      0

    B

      1

    C

      2

    D

      3


    正确答案: C
    解析: 暂无解析

  • 第23题:

    单选题
    现有:   1. interface Altitude {   2.   //insert code here  3. }    和4个声明:  int HIGH = 7;   public int HIGH = 7;   abstract int HIGH = 7;   interface int HIGH = 7;    分别插入到第2行,有多少行可以编译?()
    A

     0

    B

     1

    C

     2

    D

     3

    E

     4


    正确答案: D
    解析: 暂无解析