• 2021-04-14
    (6-10)有如下代码,请为指定位置选择正确代码。( )
    class Outer{
    class Inner{
    void show() {
    System.out.println("inner");
    }


    }
    public void aOuterMethod() {
    // ①
    }
    public static void main(String[] args) {
    Outer out=new Outer();
    // ②
    Outer.Inner inn=out.new Inner();
    // inn.show();
    }
    }
  • ① new Inner();② Inner inn=out.new Inner();② Outer.Inner inn=out.new Inner();

    内容

    • 0

      请阅读下面的程序,写出最终的结果: interface Inter { public void show(); } abstract class AbstractInter implements Inter { public void show() { System.out.println("AbstractInter show()"); } } class InterImpl extends AbstractInter { public void show() { System.out.println("InterImpl show()"); } } public class InterImplTest { public static void main(String[] args) { InterImpl i = new InterImpl(); i. show(); } }

    • 1

      Which of the following sentence is right in G major ? A: An open inner string counts as 2, the outer string counts as 5 B: An open inner string counts as 5, the outer string counts as 2 C: An open inner string counts as 2, the outer string counts as 6 D: An open inner string counts as 6, the outer string counts as 3

    • 2

      阅读下列的程序 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"); } } A. B. C. D.

    • 3

      What is the material of the doll's packing? A: The inner is Bag and the outer is Carton. B: The inner is Bag and the outer is Box. C: The inner is Box and the outer is Carton. D: The inner and the outer are both Box.

    • 4

      下列程序运行结果是(  ) public class Demo {     public static void main(String[] args) {         Object obj=new Father(){             public void show(){                 System.out.println("helloworld");             }         };         obj.show();     } } class Father{     public void show(){         System.out.println("hello father");     } }