This page contains an archived post to the Java Answers Forum made prior to February 25, 2002.
If you wish to participate in discussions, please visit the new
Artima Forums.
Message:
Compiling errors
Posted by Don Williams on September 03, 2000 at 2:31 AM
****This is what the book had me type**** ****Please help me figure what is wrong and how can i correct it**** ****Also where can i find a list of javac error codes and what they mean?**** class Motorcycle { String make; String color; boolean engineState; public static void main (String args[]) { Motorcycle m = new Motorcycle(); m.make = "Yamaha RZ350"; m.color = "yellow"; System.out.println("Calling showAtts..."); m.showAtts(); System.out.println("--------"); System.out.println("Starting engine..."); m.startEngine(); System.out.println("--------"); System.out.println("Calling showAtts..."); m.showAtts(); System.out.println("--------"); System.out.println("Starting engine..."); m.startEngine(); void startEngine() { if (engineState == true) System.out.println("The engine is already on!"); else { engineState = true; System.out.println("The engine is now on!"); } } } void showAtts() { System.out.println("This motorcycle is a " + color + " " + make); if (engineState == true) System.out.println("The engine is on!"); else System.out.println("The engine is off!"); } ****This is the errors javac spit out**** C:\TYJava\JDK\html>javac 2Motorcycle.java 2Motorcycle.java:19: '}' expected. m.startEngine(); ^ 2Motorcycle.java:20: Statement expected. void startEngine() { ^ 2Motorcycle.java:29: Class or interface declaration expected. void showAtts() { ^ 3 errors ****Please help me figure what is wrong and how can i correct it**** ****Also where can i find a list of javac error codes and what they mean?****
Replies:
|