运行 ❯
获取您自己的
Java 服务器
×
更改方向
更改主题,深色/浅色
前往 Spaces
final class Vehicle { protected String brand = "Ford"; public void honk() { System.out.println("Tuut, tuut!"); } } class Main extends Vehicle { private String modelName = "Mustang"; public static void main(String[] args) { Main myFastCar = new Main(); myFastCar.honk(); System.out.println(myFastCar.brand + " " + myFastCar.modelName); } }
Main.java:9: 无法从最终的 Vehicle 继承
class Main extends Vehicle {
^
1 个错误