多选题Which the following two statements are true?()AAn inner class may be declared as static.BAn anonymous inner class can be declared as public.CAn anonymous inner class can be declared as private.DAn anonymous inner class can extend an abstract class.EAn 

题目
多选题
Which the following two statements are true?()
A

An inner class may be declared as static.

B

An anonymous inner class can be declared as public.

C

An anonymous inner class can be declared as private.

D

An anonymous inner class can extend an abstract class.

E

An anonymous inner class can be declared as protected.


相似考题
更多“多选题Which the following two statements are true?()AAn inner class may be declared as static.BAn anonymous inner class can be declared as public.CAn anonymous inner class can be declared as private.DAn anonymous inner class can extend an abstract class.EAn ”相关问题
  • 第1题:

    package foo;  public class Outer {  public static class Inner {  }  }   Which statement is true?() 

    • A、 Compilation fails.
    • B、 An instance of the Inner class can be constructed with “new Outer.Inner()”.
    • C、 An instance of the Inner class cannot be constructed outside of package foo.
    • D、 An instance of the Inner class can be constructed only from within the Outer class.
    • E、 From within the package foo, and instance of the Inner class can be constructed with “new Inner()”.

    正确答案:B

  • 第2题:

    Which thefollowingstatements about static inner classes is true?()

    • A、 An anonymous class can be declared as static.
    • B、 A static inner class cannot be a static member of the outer class.
    • C、 A static inner class does not require an instance of the enclosing class.
    • D、 Instance member of a static inner class can be referenced using the class name of the staticinner class.

    正确答案:C

  • 第3题:

    package foo; public class Outer (  public static class Inner (  )  )   Which statement is true? () 

    • A、 An instance of the Inner class can be constructed with “new Outer.Inner ()”
    • B、 An instance of the inner class cannot be constructed outside of package foo.
    • C、 An instance of the inner class can only be constructed from within the outer class.
    • D、 From within the package bar, an instance of the inner class can be constructed with “new inner()”

    正确答案:A

  • 第4题:

    public class OuterClass {   private double d1 1.0;   //insert code here   }   You need to insert an inner class declaration at line2. Which two inner class declarations are valid?()

    • A、 static class InnerOne {  public double methoda() {return d1;}  }
    • B、 static class InnerOne {  static double methoda() {return d1;}  }
    • C、 private class InnerOne {  public double methoda() {return d1;}  }
    • D、 protected class InnerOne {  static double methoda() {return d1;}  }
    • E、 public abstract class InnerOne {  public abstract double methoda();  }

    正确答案:C,E

  • 第5题:

    Which statements about static inner classes are true?()

    • A、 A static inner class requires a static initializer.
    • B、 A static inner class requires an instance of the enclosing class.
    • C、 A static inner class has no reference to an instance of the enclosing class.
    • D、 A static inner class has access to the non-static members of the outer class.
    • E、 Static members of a static inner class can be referenced using the class name of the static inner  class.

    正确答案:C,E

  • 第6题:

    AnInterface is an interface.   AnAdapter0 is a non-abstract, non-final class with a zero argument constructor.   AnAdapter1 is a non-abstract, non-final class without a zero argument constructor, but with a constructor that takes one int argument.    Which two construct an anonymous inner class?()   

    • A、AnAdapter1 aa=new AnAdapter1(){}
    • B、AnAdapter0 aa=new AnAdapter0(){}
    • C、AnAdapter0 aa=new AnAdapter0(5){}
    • D、AnAdapter1 aa=new AnAdapter1(5){}
    • E、AnInterface a1=new AnInterface(5){}

    正确答案:B,D

  • 第7题:

    单选题
    Which statement is true?()
    A

     An anonymous inner class may be declared as final.

    B

     An anonymous inner class can be declared as private.

    C

     An anonymous inner class can implement multiple interfaces.

    D

     An anonymous inner class can access final variables in any enclosing scope.

    E

     Construction of an instance of a static inner class requires an instance of the enclosing outer class.


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

  • 第8题:

    多选题
    public class OuterClass {  private double d1  1.0;  //insert code here   }   You need to insert an inner class declaration at line2. Which two inner class declarations are valid?()
    A

    static class InnerOne {  public double methoda() {return d1;}  }

    B

    static class InnerOne {  static double methoda() {return d1;} }

    C

    private class InnerOne {  public double methoda() {return d1;} }

    D

    protected class InnerOne {  static double methoda() {return d1;} }

    E

    public abstract class InnerOne {  public abstract double methoda();  }


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

  • 第9题:

    多选题
    Which statements can be inserted at the indicated position in the following code to make the program write 1 on the standard output when run?()  public class Q4a39 {  int a = 1;   int b = 1;   int c = 1;   class Inner {   int a = 2;  int get() {   int c = 3;   // insert statement here  return c;   }   }  Q4a39() {   Inner i = new Inner();   System.out.println(i.get());  }   public static void main(String args[]) {   new Q4a39();   }   }
    A

    c = b;

    B

    c = this.a;

    C

    c = this.b;

    D

    c = Q4a39.this.a;

    E

    c = c;


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

  • 第10题:

    多选题
    Which two statements are true?()
    A

    An inner class may be declared as static.

    B

    An anonymous inner class can be declared as public.

    C

    An anonymous inner class can be declared as private.

    D

    An anonymous inner class can extend an abstract class.

    E

    An anonymous inner class can be declared as protected.


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

  • 第11题:

    多选题
    Which statements about static inner classes are true?()
    A

    A static inner class requires a static initializer.

    B

    A static inner class requires an instance of the enclosing class.

    C

    A static inner class has no reference to an instance of the enclosing class.

    D

    A static inner class has access to the non-static members of the outer class.

    E

    Static members of a static inner class can be referenced using the class name of the static inner  class.


    正确答案: E,B
    解析: 暂无解析

  • 第12题:

    多选题
    Which the following two statements are true?()
    A

    An inner class may be declared as static.

    B

    An anonymous inner class can be declared as public.

    C

    An anonymous inner class can be declared as private.

    D

    An anonymous inner class can extend an abstract class.

    E

    An anonymous inner class can be declared as protected.


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

  • 第13题:

    Which statements can be inserted at the indicated position in the following code to make the program write 1 on the standard output when run?()  public class Q4a39 {  int a = 1;   int b = 1;   int c = 1;   class Inner {   int a = 2;  int get() {   int c = 3;   // insert statement here  return c;   }   }  Q4a39() {   Inner i = new Inner();   System.out.println(i.get());  }   public static void main(String args[]) {   new Q4a39();   }   }  

    • A、c = b;
    • B、c = this.a;
    • C、c = this.b;
    • D、c = Q4a39.this.a;
    • E、c = c;

    正确答案:A,D

  • 第14题:

    Anonymous Inner Class(匿名内部类)是否可以extends(继承)其它类,是否可以implements(实现)interface(接口)?


    正确答案: 匿名的内部类是没有名字的内部类。不能extends(继承) 其它类,但一个内部类可以作为一个接口,由另一个内部类实现。

  • 第15题:

    Which the following two statements are true?()

    • A、 An inner class may be declared as static.
    • B、 An anonymous inner class can be declared as public.
    • C、 An anonymous inner class can be declared as private.
    • D、 An anonymous inner class can extend an abstract class.
    • E、 An anonymous inner class can be declared as protected.

    正确答案:A,D

  • 第16题:

    Which statement about static inner classes is true? () 

    • A、 An anonymous class can be declared as static.
    • B、 A static inner class cannot be a static member of the outer class.
    • C、 A static inner class does not require an instance of the enclosing class.
    • D、 Instance members of a static inner class can be referenced using the class name of the static inner class.

    正确答案:C

  • 第17题:

    Which statement is true?()

    • A、 An anonymous inner class may be declared as final.
    • B、 An anonymous inner class can be declared as private.
    • C、 An anonymous inner class can implement multiple interfaces.
    • D、 An anonymous inner class can access final variables in any enclosing scope.
    • E、 Construction of an instance of a static inner class requires an instance of the enclosing outer class.

    正确答案:D

  • 第18题:

    单选题
    package foo;  public class Outer {  public static class Inner {  }  }   Which statement is true?()
    A

     Compilation fails.

    B

     An instance of the Inner class can be constructed with “new Outer.Inner()”.

    C

     An instance of the Inner class cannot be constructed outside of package foo.

    D

     An instance of the Inner class can be constructed only from within the Outer class.

    E

     From within the package foo, and instance of the Inner class can be constructed with “new Inner()”.


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

  • 第19题:

    多选题
    AnInterface is an interface. AnAdapter0 is a non-abstract, non-final class with a zero argument constructor. An Adapterl is a non-abstract, non-final class without a zero argument constructor, but with a constructor that takes one int argument.   Which two construct an anonymous inner class()?
    A

    AnAdapter1 aa = new AnAdapter1 () {}

    B

    AnAdapter0 aa = new AnAdapter0 () {}

    C

    AnAdapter0 aa = new AnAdapter0 (5) {}

    D

    AnAdapter1 aa = new AnAdapter1 (5) {}

    E

    AnInterface ai = new Anlnterface (5)) {}


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

  • 第20题:

    问答题
    Anonymous Inner Class (匿名内部类) 是否可以extends(继承)其它类,是否可以implements(实现)interface(接口)?

    正确答案: 匿名的内部类是没有名字的内部类。不能extends(继承) 其它类,但一个内部类可以作为一个接口,由另一个内部类实现。
    解析: 暂无解析

  • 第21题:

    多选题
    Which statements concerning the correlation between the inner and outer instances of non-static inner classes are true?()
    A

    Member variables of the outer instance are always accessible to inner instances, regardless of their      accessibility modifiers.

    B

    Member variables of the outer instance can never be referred to using only the variable name within     the inner instance.

    C

    More than one inner instance can be associated with the same outer instance.

    D

    All variables from the outer instance that should be accessible in the inner instance must be declared     final.

    E

    A class that is declared final cannot have any inner classes.


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

  • 第22题:

    单选题
    Which statement about static inner classes is true? ()
    A

     An anonymous class can be declared as static.

    B

     A static inner class cannot be a static member of the outer class.

    C

     A static inner class does not require an instance of the enclosing class.

    D

     Instance members of a static inner class can be referenced using the class name of the static inner class.


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

  • 第23题:

    多选题
    AnInterface is an interface.   AnAdapter0 is a non-abstract, non-final class with a zero argument constructor.   AnAdapter1 is a non-abstract, non-final class without a zero argument constructor, but with a constructor that  takes one int argument.   Which two construct an anonymous inner class? ()
    A

    AnAdapter1 aa=new AnAdapter1(){}

    B

    AnAdapter0 aa=new AnAdapter0(){}

    C

    AnAdapter0 aa=new AnAdapter0(5){}

    D

    AnAdapter1 aa=new AnAdapter1(5){}

    E

    AnInterface a1=new AnInterface(5){}


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

  • 第24题:

    单选题
    Which thefollowingstatements about static inner classes is true?()
    A

     An anonymous class can be declared as static.

    B

     A static inner class cannot be a static member of the outer class.

    C

     A static inner class does not require an instance of the enclosing class.

    D

     Instance member of a static inner class can be referenced using the class name of the staticinner class.


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