java吧 关注:1,248,556贴子:12,729,316
  • 1回复贴,共1

求教 哪位大神给我看看为什么运行出来的结果没有参数

取消只看楼主收藏回复





运行的结果为什么没有参数不知道哪里出问题了


IP属地:北京1楼2014-12-24 15:45回复
    是这段代码;
    编写java应用程序封装一个Student类的对象。
    其中定义一个表示学生的类Student,
    包括姓名 ,性别,年龄;学号:
    获得姓名,获得性别;获得年龄,获得学号;修改姓名.....。
    另加一个方法public String toString()
    把Student类对象的所有属性信息组合成一个字符串。检验程序。
    我的代码是这样的
    public class students {
    public String name;
    public String sex;
    public double id;
    public int age;
    public students(String name, String sex, int age, double number) {
    // TODO Auto-generated constructor stub
    }
    public String getName() {
    return name;
    }
    public void setName(String name) {
    this.name = name;
    }
    public String getSex() {
    return sex;
    }
    public void setSex(String sex) {
    this.sex = sex;
    }
    public double getId() {
    return id;
    }
    public void setId(double id) {
    this.id = id;
    }
    public int getAge() {
    return age;
    }
    public void setAge(int age) {
    this.age = age;
    }
    public String toString() {
    return "学生信息如下\n" + "|-姓名:" + this.getName() + "|-性别" + this.getSex()
    + " 年龄:" + this.getAge() + " 学号:" + this.getId();
    }
    }
    -----------------------------------------------------------
    public class tsst {
    public static void main(String[] args) {
    // TODO Auto-generated method stub
    {
    students sd= new students("吱嘎","男",25,1234569987);
    System.out.println(sd);
    }
    }
    }


    IP属地:北京2楼2014-12-24 15:50
    回复