Код: Выделить всё
No enclosing instance is accessible. Must qualify the allocation with an enclosing instance of type (e.g. x.new A() where x is an instance of )",
Код: Выделить всё
package moreAboutOOP;
public class Inheritance {
public class Vehicle {
protected String licensePlate = null;
public void setLicensePlate(String license) {
this.licensePlate = license;
}
}
public class Car extends Vehicle {
int numberOfSeats = 0;
public int getNumberOfSeats() {
return (this.numberOfSeats);
}
public String getLicensePlate() {
return this.licensePlate;
}
}
public static void main(String[] args) {
Vehicle v1 = new Vehicle();
v1.setLicensePlate("P125ADS");
Car c1 = new Car();
c1.setLicensePlate("P124ABS");
System.out.println("");
}
}