• 2021-04-14
    请阅读下面的程序
    class Test {
    private static String name;
    static {
    name = "World";
    System.out.print (name);
    }
    public static void main(String[] args) {
    System.out.print("Hello");
    Test test = new Test();
    }
    }
    下列选项中,程序运行结果是
  • WorldHello

    内容

    • 0

      class Person{ static{ System.out.println(name); } private static String name = "hello"; } class Demo{ public static void main(String[] args){ Person p = null; } }

    • 1

      下列代码的执行结果是 。public class Test {public int aMethod(){static int i=0;i++;System.out.println(i);}public static void main(String args[ ]){Test test = new Test();test.aMethod();}}

    • 2

      (6-6)请阅读程序,写出程序运行结果。 class Test{ static int x=10; int y=99; { y=y+10; } static { x=x+5; } { y=y+10; } static { x=x+5; } public Test() {//构造方法 x=x+5; } { System.out.println(x*y); } } public class Demo11 { public static void main(String[] args) { Test t1=new Test(); Test t2=new Test(); } }

    • 3

      下列程序的运行结果是()。 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 ) _

    • 4

      以下程序的输出结果为?public class Test {public static void main(String args[]) {for ( int k = 0; k < 3; k++)System.out.print("k");}}