Run ❯
Get your
own
website
×
Change Orientation
Change Theme, Dark/Light
Go to 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: cannot inherit from final Vehicle
class Main extends Vehicle {
^
1 error