发布时间:2025-01-17 14:39
作者:admin
栏目:心安手游
我看都后面都看蒙了,怎么再vehicle中创建静态的内部类car
还要用另一个内部类来继承
这个不应该是这样的吧
应该是定义vehicle类
然后定义car类继承vehicle
用car1继承car
这样还差不多
public class Vehicle
{
private static int wheelNum;
private int loadNum;
public int journey;
然后添加get和set方法
public static void main (String []args)
{
}
}
class Car extends Vehicle
{
String color ;
String style;
public Car(String color, String style)
{
super();
this.color=color;
this.style=style;
}
public void drive(){
System.out.println(super.get方法);
}
class Car1 extends Car{
public Car1(String color)
super.color=color;
}
结构发给就这样