父類
public class Uncle {
private String name;
private int age;
public Uncle(){
System.out.println("uncle構(gòu)造方法");
}
public void fahongbao(){
System.out.println("舅舅發(fā)紅包");
}
}
子類一:
public class UncleOne extends Uncle{
public UncleOne(){
super();
System.out.println("uncleone的構(gòu)造方法");
}
public void chouyan(){
System.out.println("大舅喜歡抽煙");
}
public void fahongbao(){
System.out.println("大舅家道中落马昨,發(fā)不起紅包了克伊,該送祝福了");
}
}
多層繼承:
public class UncleUneSon extends UncleOne{
public UncleUneSon(){
System.out.println("UncleOneSon的構(gòu)造方法");
}
public void fahongbao(){
System.out.println("大舅的兒子厲害了款侵,接著發(fā)紅包");
}
}
子類二:
public class UncleTwo extends Uncle{
public void hejiu(){
System.out.println("二舅喜歡喝酒");
}
//方法的重寫 復寫 覆寫
public void fahongbao(){
System.out.println("二舅不僅發(fā)紅包還送茅臺");
}
}
public class Demo {
public static void main(String[] args) {
/* UncleOne uncleOne=new UncleOne();
uncleOne.fahongbao();
uncleOne.chouyan();
UncleTwo uncleTwo=new UncleTwo();
uncleTwo.fahongbao();
uncleTwo.hejiu();
UncleUneSon uncleUneSon=new UncleUneSon();
uncleUneSon.fahongbao();*/
UncleUneSon uncleUneSon= new UncleUneSon();
}
}
package edu.xcdq;
public class Demo01 {
public static void main(String[] args) {
final double PI=3.14;
//PI=6.25;
final int[]a=new int[]{1,2,3};
a[0]=10;
a[1]=20;
a[2]=30;
int []b=new int[3];
System.out.println(a[0]);
System.out.println(a[1]);
System.out.println(a[2]);
}
}