package wang;
/**
- @author wangyongsheng
- @date 2021/4/23 8:11
*/
public class uncle {
private String name;
private int age;
public uncle(){
System.out.println("舅的構(gòu)造方法被創(chuàng)建");
}
public void fahongbao(){
System.out.println("發(fā)紅包");
}
public void maiche(){
System.out.println("舅舅送車");
}
}
package wang;
/**
- @author wangyongsheng
- @date 2021/4/23 8:12
*/
public class UncleOne {
public void hejiu(){
System.out.println("大舅喜歡喝酒");
}
public void faHongbao(){
System.out.println("大舅喜歡發(fā)紅包");
}
}
package wang;
/**
- @author wangyongsheng
- @date 2021/4/23 8:13
/
public class demo05 {
public static void main(String[] args) {
/ UncleOne uncleOne=new UncleOne();
uncleOne.faHongbao();
uncleOne.hejiu();
UncleTwo uncleTwo=new UncleTwo();
uncleTwo.fahongbao();
uncleTwo.chouyan();*/
UncleTwoSon uncleTwoSon=new UncleTwoSon();
/*uncleTwoSon.fahonhgbao();
uncleTwoSon.maiche();*/
}
}
package wang;
/**
- @author wangyongsheng
- @date 2021/4/23 9:10
*/
public class demo06 {
public static void main(String[] args) {
final int a=1;
final int []b={1,2,3};
b[0]=10;
b[1]=20;
b[2]=30;
int []c=new int[3];
//b=c;
}
}
package wang;
/**
@author wangyongsheng
-
@date 2021/4/23 8:13
*/
public class UncleTwo extends uncle {public UncleTwo(){
System.out.println("二舅的構(gòu)造方法");}
//獨有的方法
public void chouyan(){
System.out.println("二舅喜歡抽煙");
}
//復(fù)寫(腹寫)Override 父類中的方法
public void fahongbao(){
System.out.println("家道中落蝇完,不發(fā)紅包");
}
}
package wang;
/**
- @author wangyongsheng
- @date 2021/4/23 8:31
*/
public class UncleTwoSon extends UncleTwo{
public UncleTwoSon(){
super(); //調(diào)用二舅方法
System.out.println("二舅兒子的方法被創(chuàng)建");
}
public void fahonhgbao(){
System.out.println("逆襲了,紅包接著發(fā)");
}
}