Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Java Loops program erros
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
slider203




PostPosted: 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.
Sponsor
Sponsor
Sponsor
sponsor
DemonWasp




PostPosted: 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:
code:
[b]int[/b] i = 1;
slider203




PostPosted: 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:
code:
[b]int[/b] i = 1;


Oh lol thanks that solved the problem Razz
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: