package test;
class father{
    int x;
    int y;
    father()
    {
        x=0;
        y=0;
    }
    void put()
    {
        System.out.println("I am father");
    }
    
}
class son extends father
{
    int x;
    int y;
    son()
    {
        x=1;
        y=1;
    }
    void put()
    {
        System.out.println("I am son");
    }
}
public class Main {
   public static void main(String args[])
   {
       father fa=new father();
       son so=new son();
       fa.put();
       so.put();
   }
}

   

I am father
I am son

posted on 2013-01-08 23:31  一把刷子  阅读(110)  评论(0编辑  收藏  举报