演示方法隐藏的测试类
class MySuper { public static void print() { System.out.println("Inside MHidingSuper.print()"); /* from nowjava.com*/ } } class MySub extends MySuper { public static void print() { System.out.println("Inside MHidingSub.print()"); } } public class Main { public static void main(String[] args) { MySuper mhSuper = new MySub(); MySub mhSub = new MySub(); System.out.println("#1"); MySuper.print(); mhSuper.print();/** 时 代 J a v a 提供 **/ System.out.println("#2"); MySub.print();