写一个主类Test,创建一个CollegeStudent类的对象

 

如有帮助,请采纳。点击我回答右上角【采纳】按钮。

public class CollegeStudent {
    private String name;
    private int age;
    private int height;

    public CollegeStudent(String name, int age, int height) {
        this.name = name;
        this.age = age;
        this.height = height;
    }

    public void show(CollegeStudent c){
        System.out.println("name为"+c.name+";age为"+c.age+";height为"+c.height);
    }
}
public class Test {
    public static void main(String[] args) {
        CollegeStudent student=new CollegeStudent("张三",24,172);
        student.show(student);
    }
}

您好,我是有问必答小助手,您的问题已经有小伙伴解答了,您看下是否解决,可以追评进行沟通哦~

如果有您比较满意的答案 / 帮您提供解决思路的答案,可以点击【采纳】按钮,给回答的小伙伴一些鼓励哦~~

ps: 问答会员年卡【8折】购 ,限时加赠IT实体书,即可 享受50次 有问必答服务,了解详情>>>https://t.csdnimg.cn/RW5m

您好,我是有问必答小助手,您的问题已经有小伙伴帮您解答,感谢您对有问必答的支持与关注!
PS:问答VIP年卡 【限时加赠:IT技术图书免费领】,了解详情>>> https://vip.csdn.net/askvip?utm_source=1146287632