パッケージjavainherit;メインクラスが見つかりません。JavaInherit
クラス車両{
String strRegNum;
String strModel;
String strMake;
String strColor;
private String strClassType = "Vehicle:";
String strIgnition;
String strRun;
void turnIgnitionOn() {
strIgnition = strClassType + " turned ON";
System.out.println(strIgnition);
}
void run() {
strRun = strClassType + " is RUNNING";
System.out.println(strRun);
}
}
クラス車は、車両{
String str1;
Car() {
str1 = "From the constructor";
}
Car (String str3) {
str1 = str3 + "From the constructor";
}
void run() {
String str = str1 + ":Car is running";
System.out.println (str);
}
void run(String str2) {
System.out.println (str2);
String str = str2 + ":Car is running";
}
}
クラスJavaInherit {
public static void main(String[] args) {
Vehicle veh = new Vehicle();
veh.turnIgnitionOn();
veh.run();
Car car1 = new Car();
car1.run();
car1.run("Overloading:");
Car car2 = new Car("New Car by default");
car2.run();
}
を拡張します
}
これは私のコードで、私はすでに、すでにすべての可能な方法は、スタックオーバーフローの答えで説明しようとしている懸念directory.Iでcar.class、JavaInherit.classとvehicle.classを持っています。