day09-抽象方法和抽象类的使用以及注意事项
This commit is contained in:
@@ -19,4 +19,8 @@ this关键字使用方式
|
||||
c.this可以调用其他的重载构造方法,但是不能互相调用(死循环)
|
||||
*/
|
||||
public class Demo06 {
|
||||
public static void main(String[] args) {
|
||||
Zi zi = new Zi();
|
||||
zi.show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ public class Zi extends Fu{
|
||||
|
||||
public Zi(){
|
||||
//调用有参构造
|
||||
this(10);
|
||||
this(111);
|
||||
}
|
||||
public Zi(int num){
|
||||
//调用满参构造
|
||||
@@ -24,7 +24,7 @@ public class Zi extends Fu{
|
||||
public void show(){
|
||||
System.out.println(super.num);
|
||||
System.out.println(super.numFu);
|
||||
System.out.println(num);
|
||||
System.out.println(num);//10 30
|
||||
System.out.println(numZi);
|
||||
super.method();//调用父类的方法
|
||||
this.methodZi();//调用本类的成员方法
|
||||
|
||||
Reference in New Issue
Block a user