• 2022-06-08
    下列程序的运行结果是______。 public class Test { public static void main (String[] args) { int x=3, y=4, z=5; if (x>3) { if (y<2) System.out.print ("show one"); else System.out.print ("show two"); } else{ if (z>4) System.out.print ("show three"); else System.out.print ("show four"); } } }
    A: show one
    B: show two
    C: show three
    D: show four
  • C

    举一反三

    内容

    • 0

      阅读下列的程序 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.

    • 1

      下列程序的运行结果是()。 public class Test public static void main ( String [ ] args ) int count = 0 for( int i = 1 i < 5 i = 2) for( int j = 1 j< = 10 j = 3) count System .out .print (count ) _

    • 2

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

    • 3

      下列的程序的运行结果是( )public class Example { public static void main(String&#91;&#93; args) { new Father () { public void show() { System.out.println("helloworld"); } }.show(); }}class Father { public void show() { System.out.println("hellofather"); }} A: hellofather B: helloworld C: 编译报错 D: 编译通过,运行报错

    • 4

      请阅读下面的程序,写出最终的结果: 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(); } }