日期:2014-05-20 浏览次数:20893 次
public class SuperClass {
private static int value = 0;
public static void setValue(int value) {
System.out.println("SuperClass.setValue(" + value + ");");
SuperClass.value = value;
}
public static int getValue() {
System.out.println("SuperClass.getValue() return : " + value + ";");
return value;
}
}
public class SubClass extends SuperClass {
public static void main(String[] args) {
System.out.println("SubClass.setValue(" + 1 + ");");
setValue(1);
System.out.println("SuperClass.getValue() return : " + getValue() + ";");
}
}
public class SuperClass {
private static int value = 0;
public static void setValue(int value) {
System.out.println("SuperClass.setValue(" + value + ");");
SuperClass.value = value;
}
public static int getValue() {
System.out.println("SuperClass.getValue() return : " + value + ";");
return value;
}
}
public class SubClass extends SuperClass {
public static void main(String[] args) {
System.out.println("SubClass.setValue(" + 1 + ");");
setValue(1);
System.out.println("SubClass.getValue() return : " + getValue() + ";");
}
}