package Super;
public class SuperTest {
String color;
//
public SuperTest(String color)
{this.color=color;
}
public SuperTest()
{
}
/*String name ="小明";
public SuperTest()
{
System.out.println("父类构造方法");
}
public SuperTest(String name )
{
System.out.println("父类构造方法......."+name);
}
void main()
{System.out.println("父类方法!!!");
}
*/
void telPhone()
{
System.out.println("使用旧版手机打电话");
}
}
package Super;
public class Mian {public static void main(String[] args)
{SuperTest st=new SuperSon("白色");
st.telPhone();
SuperSon stt=(SuperSon)st;
stt.listenMusic();
}
}
package Super;
public class SuperSon extends SuperTest{
String color;
//
public SuperSon(String color)
{this.color=color;
}
/*
String name="小强";
public SuperSon(String name )
{super("小明");
System.out.println("子类构造方法./////"+name);}
void main()
{
super.main();
System.out.println("子类方法!!!");
}
public static void main(String [] args)
{
SuperSon ss=new SuperSon("小强");
ss.main();
}*/
void telPhone()
{
System.out.println("使用"+color+"新版手机打电话");
}
void listenMusic()
{
System.out.println(color+"颜色的新版手机可以听音乐");
}
}