习题

 1 package xiti10;
 2 
 3 public class xiti100201
 4 {
 5 
 6     public xiti100201()
 7     {
 8         System.out.println("父类.习题");
 9     }
10     
11     public void doSomething()
12     {
13         System.out.println("父类.习题01");
14     }
15     
16     public void doAnything()
17     {
18         System.out.println("父类.习题02");
19     }
20     
21 }
22 class xiti100202 extends xiti100201
23 {
24     public void doAnything()
25     {
26         System.out.println("子类.习题02");
27     }
28 }
View Code
 1 package xiti10;
 2 
 3 public class xiti1002 
 4 {
 5 
 6     public static void main(String[] args) 
 7     {
 8         xiti100202 xi = new xiti100202();
 9         
10         xiti100201 x = new xiti100202();
11         
12         x.doSomething();
13         
14         x.doAnything();
15         
16 
17     }
18 
19 }
View Code
原文地址:https://www.cnblogs.com/zxw0004/p/4883996.html