静态方法可以被继承但不能被覆盖,另:谁声明就调用谁的静态方法,而不管实例是谁的实例.
public class Test100107
{
public static void main(String[] args)
{
Test100107P testp = new Test100107S();
testp.print();
Test100107S tests = new Test100107S();
tests.print();
}
}
class Test100107P
{
public static void print()
{
System.out.println("p");
}
}
class Test100107S extends Test100107P
{
// public static void print()
// {
// System.out.println("s");
// }
}