0
why the code is not working? Kindly help me in locating the error.
public class Vehicle { int maxspeed; int wheels; String color; double fuelCapacity; void horn() { System.out.println("Beep!"); } } class MyClass { public static void main(String[ ] args) { Vehicle v1 = new Vehicle(); Vehicle v2 = new Vehicle(); v1 color = "red"; v2 horn(); } } result: ./Playground/MyClass.java:9: error: ';' expected v2 horn(); ^ 1 error why it is so...??? Kindly help
1 Odpowiedź
+ 2
v2.horn();