Error compiling basic java code
- by Michael Younani
New to java. Practicing coding by following a book.
Heres my code:
class Motorcycle {
//Three instance variables - make and color are strings. while a boolean refers to TRUE OR FLASE(in this case off or on)
String make;
String color;
boolean engineState;
void startEngine() {
if (engineState == true)
System.out.print("The engine is already on.");
else {
engineState = true;
System.out.print("The engine is now on.");
}
void showAtts() {
System.out.print("This motorcycle is a " + color + " " + make);
if (engineState ==true)
System.out.print("The engine is on.");
else System.out.print("The engine is off.");
}
}
}
When I compile I get 2 errors:
1) illegal start of expression
2) ; expected
I can't pin point the problem. If anyone can direct me or hint me please do.