#29.编写一个Java应用程序,设计一个汽车类Vehicle,包含的属性有车轮个数 wheels和车重weight.小车类Car是Vehicle的子类,其中包含的属性有载人数 loader.卡车类Truck是Car类的子类,其中包含的属性有载重量payload.每个 类都有构造方法和输出相关数据的方法.最后,写一个测试类来测试这些类的功 能. package hanqi; public class Vehicle { private int wheels; private int weight
package b; public interface CanFly { public void fly(); } package b; public class FeiJi implements CanFly { @Override public void fly() { System.out.println("飞机 化工能源飞行"); } } package b; public class Niao implements CanFly { @Override public void
package a; public interface InterfaceA { int method(int n); } package a; public class ClassA implements InterfaceA { public int method(int n) { int sum=0; for (int i = 1; i <=n; i++) { sum+=i; } System.out.println("1+2+3+......+"+n+"=&qu
package car; public class Vehicle { //定义成员变量 private int wheels; private double weight; public int getWheels() { return wheels; } public void setWheels(int wheels) { this.wheels = wheels; } public double getWeight() { return weight; } public void set