|
- package day07;
- //一、 实现从控制台接收一个学员信息,并存储到一个对象中
- //二、 打印这个对象的所有属性值。
- public class xuesheng {
- private String name;
- private String banji;
- private int nianl;
- private double shenggao;
- public xuesheng() {
-
- }
- public xuesheng(String name, String banji, int nianl, double shenggao) {
- this.name = name;
- this.banji = banji;
- this.nianl = nianl;
- this.shenggao = shenggao;
- }
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public String getBanji() {
- return banji;
- }
- public void setBanji(String banji) {
- this.banji = banji;
- }
- public int getNianl() {
- return nianl;
- }
- public void setNianl(int nianl) {
- this.nianl = nianl;
- }
- public double getShenggao() {
- return shenggao;
- }
- public void setShenggao(double shenggao) {
- this.shenggao = shenggao;
- }
- public void show() {
- System.out.println("name=" + name + ", banji=" + banji + ", nianl=" + nianl + ", shenggao=" + shenggao );
- }
-
-
- }
复制代码- package day07;
- //一、 实现从控制台接收一个学员信息,并存储到一个对象中
- //二、 打印这个对象的所有属性值。
- //private String name;
- //private String banji;
- //private int nianl;
- //private int shenggao;
- public class Demo_2 {
- public static void main(String[] args) {
- xuesheng xs = new xuesheng("艾雨","高一九班",18,1.8);
- xs.show();
- }
-
-
- }
复制代码 文件已经打包 供下载参考
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|