Outer类中定义了一个静态内部类Inner,需要在main()方法中创建Inner类实例对象,以下四种方式哪一种是正确的? ()A.Inner in = new Inner();B.Inner in = new Outer.Inner();C.Outer.Inner in = new Outer.Inner();D.Outer.Inner in = new Outer().new Inner()

Outer类中定义了一个静态内部类Inner,需要在main()方法中创建Inner类实例对象,以下四种方式哪一种是正确的? ()

A.Inner in = new Inner();

B.Inner in = new Outer.Inner();

C.Outer.Inner in = new Outer.Inner();

D.Outer.Inner in = new Outer().new Inner()


参考答案和解析
Outer.Inner in = new Outer.Inner();

相关考题:

在实现单例模式时,大概的思路是() A.在类中定义一个静态的类自己数据类型的引用B.在类中定义一个公有的类自己数据类型的引用C.定义一个静态的获得该实例的方法D.定义一个非静态的获得该实例的方法

在面向对象方法学中,以下关于类与对象的关系正确的是()。 A.类称为是对象的一个“实例",对象称为是类的”模板”B.类是静态的,对象的动态的C.类给出了属于该类的全部对象的抽象定义。对象是符合这种定义的一个实体D.类代表-类抽象的概念或事物,对象是在客观世界中实际存在的

以下关于类和对象的叙述中,正确的是__(44) 。A.对象是类的实例B.每个类都必须创建一个实例C.每个类只能创建一个实例D.类的实例化是指对类进行初始化

以下关于内部类的说明中不正确的是( )。A.内部类可以声明为public、private或protectedB.内部类不可以定义为abstractC.内部类不能与包含它的类名相同D.内部类可以使用包含它的类的成员变量,包括静态和实例成员变量,也可以使用内部类所在方法的局部变量

以下程序的调试结果为?public class Outer{public String name = "Outer";public static void main(String argv[]){Inner i = new Inner();i.showName();}private class Inner{String name =new String("Inner");void showName(){System.out.println(name);}}}A.输出结果 OuterB.输出结果 InnerC.编译错误,因Inner类定义为私有访问D.在创建Inner类实例的行出现编译错误

关于静态成员,下列说法正确的是()A、 同一个类中的静态成员,类实例化后,在不同的对象中形成不同的静态成员B、 在类实例化后,同类型的对象都共享类的静态成员,静态成员只有一个版本C、 在类定义时静态成员属于类,在类实例化后静态成员属于对象D、 在类实例化后静态成员已被实例化,因此不同的对象有不同的静态成员

1. public class Outer{  2. public void someOuterMethod() {  3. // Line 3  4. }  5. public class Inner{}  6. public static void main( String[]argv ) {  7. Outer o = new Outer();  8. // Line 8  9. }  10. }  Which instantiates an instance of Inner?()  A、 new Inner(); // At line 3B、 new Inner(); // At line 8C、 new o.Inner(); // At line 8D、 new Outer.Inner(); // At line 8

What is true regarding subqueries?()A、The inner query always sorts the results of the outer queryB、The outer query always sorts the results of the inner queryC、The outer query must return a value to the outer queryD、The inner query returns a value to the outer queryE、The inner query must always return a value or the outer query will give an error

下列连接中能自动删除重复的列是()。A、INNER JOINB、LEFT OUTER JOINC、RIGHT OUTER JOIND、FULL OUTER JOIN

造函数用于创建类的实例对象,构造函数名应与类名相同,在类中必须定义构造函数,且只能定义一个构造函数。

关于main()方法说法正确的是()A、一个类中可以没有main()B、所有对象都必须放在main()方法中C、main()必须放在公共类中D、main()方法头的定义可以根据情况任意修改

关于线程的创建过程,下面四种说法正确的有哪些?()A、定义Thread类的子类,重写Thread类的run()方法,创建该子类的实例对象,调用对象的start()方法B、定义Thread类的子类,重写Thread类的run()方法,创建该子类的实例对象,调用对象的run()方法C、定义一个实现Runnable 接口的类并实现run()方法,创建该类实例对象,将其作为参数传递给Thread类的构造方法来创建Thread对象,调用Thread对象的start()方法D、定义一个实现Runnable 接口的类并实现run()方法,创建该类对象,然后调用run()方法

假定要在一个类XXK5中访问另一个类XXK4中的实例成员abc,则首先要在XXK5中创建()类的一个实例对象,然后通过这个对象进行访问。

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()”

class Birds {  public static void main(String [] args) {  try {  throw new Exception();  } catch (Exception e) { try {  throw new Exception();  } catch (Exception e2) { System.out.print("inner "); }  System.out.print("middle "); }  System.out.print("outer ");  }  }  结果为:()  A、innerB、inner outerC、middle outerD、inner middle outer

What is true regarding subqueries?()A、The inner query always sorts the results of the outer query.B、The outer query always sorts the results of the inner query.C、The outer query must return a value to the inner query.D、The inner query returns a value to the outer query.E、The inner query must always return a value or the outer query will give an error.

填空题假定要在一个类XXK5中访问另一个类XXK4中的实例成员abc,则首先要在XXK5中创建()类的一个实例对象,然后通过这个对象进行访问。

单选题关于静态成员,下列说法正确的是()A 同一个类中的静态成员,类实例化后,在不同的对象中形成不同的静态成员B 在类实例化后,同类型的对象都共享类的静态成员,静态成员只有一个版本C 在类定义时静态成员属于类,在类实例化后静态成员属于对象D 在类实例化后静态成员已被实例化,因此不同的对象有不同的静态成员

单选题While a ship with twin screw is making a turn, in order to prevent overload, the duty engineer should ()Areduce the fuel feeding of main engine of inner propellerBreduce the fuel feeding of main engine of outer propellerCfirstly reduce the fuel of main engine of inner propeller, then reduce the fuel feeding of engine of outer propellerDreduce fuel feeding of two engines at the same time

单选题关于main()方法说法正确的是()A一个类中可以没有main()B所有对象都必须放在main()方法中Cmain()必须放在公共类中Dmain()方法头的定义可以根据情况任意修改

多选题关于线程的创建过程,下面四种说法正确的有哪些?()A定义Thread类的子类,重写Thread类的run()方法,创建该子类的实例对象,调用对象的start()方法B定义Thread类的子类,重写Thread类的run()方法,创建该子类的实例对象,调用对象的run()方法C定义一个实现Runnable 接口的类并实现run()方法,创建该类实例对象,将其作为参数传递给Thread类的构造方法来创建Thread对象,调用Thread对象的start()方法D定义一个实现Runnable 接口的类并实现run()方法,创建该类对象,然后调用run()方法

单选题What is true regarding subqueries?()AThe inner query always sorts the results of the outer queryBThe outer query always sorts the results of the inner queryCThe outer query must return a value to the outer queryDThe inner query returns a value to the outer queryEThe inner query must always return a value or the outer query will give an error

单选题1. public class Outer{  2. public void someOuterMethod() {  3. // Line 3  4. }  5. public class Inner{}  6. public static void main( String[]argv ) {  7. Outer o = new Outer();  8. // Line 8  9. }  10. }  Which instantiates an instance of Inner?()A new Inner(); // At line 3B new Inner(); // At line 8C new o.Inner(); // At line 8D new Outer.Inner(); // At line 8

单选题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在类中定义一个静态的类自己数据类型的引用B在类中定义一个公有的类自己数据类型的引用C定义一个静态的获得该实例的方法D定义一个非静态的获得该实例的方法

单选题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()”.

多选题Which statements concerning the correlation between the inner and outer instances of non-static inner classes are true?()AMember variables of the outer instance are always accessible to inner instances, regardless of their accessibility modifiers.BMember variables of the outer instance can never be referred to using only the variable name within  the inner instance.CMore than one inner instance can be associated with the same outer instance.DAll variables from the outer instance that should be accessible in the inner instance must be declared  final.EA class that is declared final cannot have any inner classes.

单选题What is true regarding subqueries?()AThe inner query always sorts the results of the outer query.BThe outer query always sorts the results of the inner query.CThe outer query must return a value to the inner query.DThe inner query returns a value to the outer query.EThe inner query must always return a value or the outer query will give an error.