码迷,mamicode.com
首页 > 其他好文 > 详细

第十章练习题----2

时间:2015-10-15 23:23:40      阅读:183      评论:0      收藏:0      [点我收藏+]

标签:

package com.Hanqi2;

public class xitizhuhanshu {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        
        
        xiti tm = new xiti("黑色","15寸");

        xitizhs tm3 = new xitizhs("蓝色","15寸");
        
        tm.Call("654");
        tm.Call("5589653");
        
        
        xiti xt = new xitizhs("蓝色","15寸");
        xt.Call("546");
    }

}

 

package com.Hanqi2;

public class xiti {
    public xiti()
    {
        
    }
    //颜色
    private String Yanse;
    
    //大小
    public String Daxiao;
    
    public String getYanse()
    {
        return Yanse;
    }
    
    public xiti(String Yanse,String Daxiao)
    {
        this.Yanse = Yanse;
        this.Daxiao = Daxiao;
        System.out.println("颜色是:"+this.Yanse+"大小为:"+Daxiao);
    }

    public void Call(String call)
    {
        System.out.println("Call: "+call);
    }
}

 

package com.Hanqi2;

public class xitizhs extends xiti {
    
    public xitizhs(String Yanse,String Daxiao)
    {
        super(Yanse,Daxiao);
    }
    public void Call(String call)
    {
        System.out.println("Call--: "+call);
    }

}

 

第十章练习题----2

标签:

原文地址:http://www.cnblogs.com/name-hanlin/p/4883774.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!