public class enclosingone ( public class insideone{} ) public class inertest( public static void main (stringargs)( enclosingone eo= new enclosingone (); //insert code here ) ) Which statement at line 7 constructs an instance of the inner class?()
A: InsideOnew ei= eo.new InsideOn();
B: Eo.InsideOne ei = eo.new InsideOne();
C: InsideOne ei = EnclosingOne.new InsideOne();
D: EnclosingOne.InsideOne ei = eo.new InsideOne();
A: InsideOnew ei= eo.new InsideOn();
B: Eo.InsideOne ei = eo.new InsideOne();
C: InsideOne ei = EnclosingOne.new InsideOne();
D: EnclosingOne.InsideOne ei = eo.new InsideOne();
举一反三
- (7-1)以下程序的运行结果是( )。 class A{ A(){ System.out.print(10); } } public class Demo extends A { public static void main(String[] args) { new A(); new Demo(); } }
- 智慧职教: public class Something { public static void main(String[] args) { Other o = new Other(); new Something().addOne(o); } public void addOne(final Other o) { o.i ; } } class Other { public int i; }
- (7-1)以下程序运行结果是()。 class FatherX{ public Integer getX() { return new Integer(10); } } class Son extends FatherX{ public Double getX() { return new Double(20); } } public class Demo12 { public static void main(String[] args) { FatherX f=new FatherX(); Son s=new Son(); System.out.println(f.getX()+s.getX()); } }
- public class Example { public static void main(String[] args) { new Father () { public void show() { System.out.println("helloworld"); } }.show(); } } class Father { public void show() { System.out.println("hellofather"); } }
- Which code, inserted at line 15, allows the class Sprite to compile?() A: Foo{public int bar(){return 1;}} B: new Foo{public int bar(){return 1;}} C: new Foo(){public int bar(){return 1;}} D: new class Foo{public int bar(){return 1;}}