Computer Science Canada Java Loops program erros |
Author: | slider203 [ Thu Mar 11, 2010 7:41 pm ] |
Post subject: | Java Loops program erros |
Hello I cant make my program run I dont see the error in it Quote: class LoopsProgram { public static void main (String args []) { System.out.println ("Loops Program"); int b = 0; final int MAX1 = 13; int increment = 2; for (i = 1; i<= MAX1; int+=increment) { System.out.println (i); b = i; } System.out.println ("After the loop b = " + b +"."); } } Here are the errors I get upon compiling the program: Quote: 3 errors found: File: F:\ICS\nEW\TEST.java [line: 27] Error: not a statement File: F:\ICS\nEW\TEST.java [line: 27] Error: '.class' expected File: F:\ICS\nEW\TEST.java [line: 32] Error: ')' expected Any help is appreciated thank you. |
Author: | DemonWasp [ Thu Mar 11, 2010 8:05 pm ] | ||
Post subject: | RE:Java Loops program erros | ||
First, if your class (which should be declared public) is LoopsProgram then it should almost certainly be in LoopsProgram.java. Second, you never declare i. The first part of your for statement should probably be:
|
Author: | slider203 [ Thu Mar 11, 2010 8:20 pm ] | ||
Post subject: | Re: RE:Java Loops program erros | ||
DemonWasp @ Thu Mar 11, 2010 8:05 pm wrote: First, if your class (which should be declared public) is LoopsProgram then it should almost certainly be in LoopsProgram.java.
Second, you never declare i. The first part of your for statement should probably be:
Oh lol thanks that solved the problem ![]() |