• 2021-04-14
    请说出下列程序的输出结果。 class Cry { public void cry() { System.out.println("大家好"); } } public class E { public static void main(String args[]) { Cry hello=new Cry() { public void cry() { System.out.println("大家好,祝工作顺利!"); } }; hello.cry(); } }
  • 大家好,祝工作顺利!

    举一反三

    内容

    • 0

      下面程序段的输出结果是 public class A{ public static void main(String args[]) { String str ="Hello,"; str=str+"Guys!"; System.out.println(str); } }

    • 1

      下列程序中注释的那个代码是错误的? abstract class Takecare{ protected void speakHello() {} public abstract static void cry(); static int f(){return 0;} abstract float g(); } A: protected void speakHello() {} B: public abstract static void cry(); C: static int f(){return 0;} D: abstract float g();

    • 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");     } }

    • 3

      【单选题】下列哪行代码有错误? public class Example{ public static void main(String args[]){ System.out.println("ok"); system.out.println("您好"); } } A. public class Example B. public static void main(String args[]) C. System.out.println("ok"); D. system.out.println("您好");

    • 4

      下列程序运行结果是( ) public class Demo { public static void main(String[] args) { Demo demo = new Demo(); demo.show(new Car() { public void run() { System.out.println("demo run"); } }); } public void show(Car c) { c.run(); } }abstract class Car { public void run() { System.out.println("car run..."); } }