package Obb;
public class gouzaoqi3 {
public gouzaoqi3(String name, int age) {//有参
}
}
class b extends gouzaoqi3{
public b() {
super("hhwq",21);
}
public b(String name, int age) {
super("hhwq",23);
}
}
public class ss({
public static void main(String[] args) {
b w = new b();
package Obb;
public class gouzaoqi4 {
public static void main(String[] args) {
net W = new net("西欧及",23,45);
net s = new net("西欧及",23);
//没有写year,要求year:78
System.out.println(s.getAge());
System.out.println(s.getName());
System.out.println(s.getYear());
}
}
class net{
private String name;
private int age;
private int year;
public net() {
}
public net(String name, int age) {
//this.name=name;
//this.age=age;
//this.year=78;
this(name,age,78);//都可以
}
public net(String name, int age, int year) {
this.name = name;
this.age = age;
this.year = year;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public int getYear() {
return year;
}
public void setYear(int year) {
this.year = year;
}
}
23
西欧及
78