创建一个student类,有三个成员变量点string num,string name ,int age
重载构造方法(3个),并调用重载入构造方法的对象创建一个printInto()方法,将对象基本信息打印出来...
重载构造方法(3个),并调用重载入构造方法的对象
创建一个printInto()方法,将对象基本信息打印出来 展开
创建一个printInto()方法,将对象基本信息打印出来 展开
1个回答
展开全部
package Object;
public class Student {
private String num;
private String name;
private int age;
public Student(){
this("println-->num","println-->name");
}
public Student(String num,String name){
this(22);
this.name=name;
this.num=num;
}
public Student(int age){
this.age=age;
}
public void printlnto(){
System.out.println(num);
System.out.println(name);
System.out.println(age);
}
public static void main(String[] args){
new Student().printlnto();
}
}
public class Student {
private String num;
private String name;
private int age;
public Student(){
this("println-->num","println-->name");
}
public Student(String num,String name){
this(22);
this.name=name;
this.num=num;
}
public Student(int age){
this.age=age;
}
public void printlnto(){
System.out.println(num);
System.out.println(name);
System.out.println(age);
}
public static void main(String[] args){
new Student().printlnto();
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询