Forum Stats

  • 3,875,419 Users
  • 2,266,914 Discussions
  • 7,912,203 Comments

Discussions

hello we are facing can't find main(String[]) method in class: Vehicle that type of error

User_8R093
User_8R093 Member Posts: 1 Green Ribbon
edited May 23, 2022 12:21PM in Java Programming

class Vehicle {

 protected String brand = "Ford";

 public void honk() {

  System.out.println("Tuut, tuut!");

 }

}


class Car extends Vehicle {

 private String modelName = "Mustang";

 public static void main(String[] args) {

  Car myFastCar = new Car();

  myFastCar.honk();

  System.out.println(myFastCar.brand + " " + myFastCar.modelName);

 }

}

this is the proggram

that run on the online compiler and mac also but not run windows 10


Answers