码迷,mamicode.com
首页 > 编程语言 > 详细

初学JAVA——方法重载练习

时间:2015-12-11 10:06:51      阅读:160      评论:0      收藏:0      [点我收藏+]

标签:

package shengji;

public class muban 
{
    String baobaoming;
    String baobaoleixing;
    String baobaoxingbie;
    public void shengji(String A)
    {
        System.out.print("你的"+baobaoxingbie+baobaoleixing+"宝宝"+
                baobaoming+"等级提升到了"+A+"级!");
    }
    public void shengji()
    {
        System.out.print("AAAAAAAAAAAAAAAAA");
    }
}
package shengji;

public class Ciwei {

    public static void main(String[] args) {
        muban ciwei=new muban();
        ciwei.baobaoleixing="刺猬";
        ciwei.baobaoming="刺肉球";
        ciwei.baobaoxingbie="公";
        ciwei.shengji("18");
        ciwei.shengji();
    }

}

 技术分享

初学JAVA——方法重载练习

标签:

原文地址:http://www.cnblogs.com/zhaoxifei/p/5037970.html

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