import com.sun.xml.internal.ws.api.model.wsdl.WSDLOutput;
//快捷键ctrl+H!!!在Java中,所有的类都默认直接或者间接继承object类
//继承,父类(基类)
//Java中只有单继承,没有多继承(1->多)
public class person {
//public公共的
//protected优先级高的
//default默认的
//private私有的:私有的不能被继承
/*
private int money = 10_0000;
public void say(){
System.out.println("说了小秘密");
}
public int getMoney(){
return money;
}
public void setMoney(int money) {
this.money = money;
}
*/
public person(){
System.out.println("person有参调用了");
}
protected String name = "jiangjiangjiang";
public void print(){
System.out.println("PRESON");
}
}
//继承 学生也是人:派生类(子类)
//子类继承了父类,就会拥有父类的所有方法
public class Student extends person {
public Student(){
//隐藏代码:调用了父类的无参构造
super();//调用父类的构造器,必须要在子类构造器的第一行
System.out.println("Student无参调用了");
}
private String name = "jiangjiang";
public void print(){
System.out.println("STUDENT");
}
public void test1() {
print();
this.print();
super.print();
}
public void test(String name){
System.out.println(name);
System.out.println(this.name);
System.out.println(super.name);
}
}
public class Application {
public static void main(String[] args) {
/*
Student student = new Student();
student.say();
System.out.println(student.getMoney());
*/
Student student1 = new Student();
//student.test("江江");
//student.test1();
}
}