class Phone
{
private void show()
{
System.out.println("private phone");
}
/*
public void method()
{
System.out.println("method Phone");
}
*/
public void method()
{
System.out.println("method Phone");
}
public static void function()
{
System.out.println("function Phone");
}
public void call()
{
System.out.println("打电话");
}
}
class NewPhone extends Phone
{
public void method()
{
System.out.println("method NewPhone");
}
public static void function()
{
System.out.println("function NewPhone");
}
public void call()
{
System.out.println("播放彩铃");
//System.out.println("打电话");
super.call();
}
}
class ExtendsDemo5
{
public static void main(String[] args)
{
NewPhone np = new NewPhone();
np.call();
}
}
|
|