日期:2014-05-20 浏览次数:20717 次
package fish4_1;
public class Fish
{
abstract class Car
{
public abstract void startUp();
}
abstract class Mazda extends Car
{
public abstract void turbo();
}
public class Mazda6 extends Car
{
public void starup()
{
System.out.println("调用了Mazda6的启动功能!!!");
}
public void turbo()
{
System.out.println("调用了Mazda6的加速功能!!!");
}
}
public class Mazda3 extends Car
{
public void starup()
{
System.out.println("调用了Mazda3的启动功能!!!");
}
public void turbo()
{
System.out.println("调用了Mazda3的加速功能!!!");
}
}
public static void main(String[] args)
{
Mazda6 m6 = new Mazda6();
m6.startUp();
m6.turbo();
Mazda3 m3 = new Mazda3();
m3.startUp();
m3.turbo();
}
}
public class Fish
{
public static void main(String[] args)
{
Mazda6 m6 = new Mazda6();
m6.startUp();
m6.turbo();
Mazda3 m3 = new Mazda3();
m3.startUp();
m3.turbo();
}
}
abstract class Car
{
public abstract void startUp();
}
abstract class Mazda extends Car
{
public abstract void turbo();
}
class Mazda6 extends Car
{
public void turbo()
{
System.out.println("调用了Mazda6的加速功能!!!");
}
@Override
public void startUp() {
// TODO Auto-generated method stub
System.out.println("调用了Mazda6的启动功能!!!");
}
}
class Mazda3 extends Car
{
public void turbo()
{
System.out.println("调用了Mazda3的加速功能!!!");
}
@Override
public void startUp() {
// TODO Auto-generated method stub
System.out.println("调用了Mazda3的启动功能!!!");
}
}