1 class Father 2 { 3 4 public static String getName() 5 { 6 return "father"; 7 } 8 } 9 10 class Children extends Father 11 { 12 public static String getName() 13 { 14 return "children"; 15 } 16 } 17 public class staticTest { 18 public static void main(String[] args) { 19 // TODO Auto-generated method stub 20 Father father=new Father(); 21 Father children=new Children(); 22 System.out.println(father.getName()); 23 System.out.println(children.getName()); 24 } 25 26 }
相关文章: