读书人

有趣的代码1

发布时间: 2012-11-07 09:56:10 作者: rapoo

有趣的代码一

public class Test {private static String LOCATION; static Integer x = 1; static Integer y = 1; static Integer x1=11111; static Integer y2=11111;public static void main(String[] args) {        new B();      System.out.print(LOCATION);      System.out.println(x==y);      System.out.println(x1==y2);}}class A{private Integer x = 1;public  Integer getX(){System.out.println("geta");return x;}public A(){System.out.println(getX());}}class B extends A{private static  Integer x = 2;public  Integer getX(){System.out.println("getb");return x;}}
?

读书人网 >编程

热点推荐