This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes While loop execution Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "While loop execution " Watch "While loop execution " New topic

While loop execution

Varshini Priya
Ranch Hand

Joined: Feb 17, 2008
Posts: 93

Hi All,

Im trying to execute simple code and Im not able to compile it. I dont see any errors in the code.

The error that I get while Compiling is

C:\Test Java>javac '.class' expected
while (int i < 10)
^ ')' expected
2 errors

the code in line 7 & 12 looks fine. Please assist

Swastik Dey

Joined: Jan 08, 2009
Posts: 1447

Its a syntax error, should be

while (i < 10)

Stephen Davies
Ranch Hand

Joined: Jul 23, 2008
Posts: 352
Yes, you have tried to reinitialize the variable i., as Swastik mentioned.

should (or could be)


be a well encapsulated person, don't expose your privates, unless you public void getWife()!
Swastik Dey

Joined: Jan 08, 2009
Posts: 1447

is it valid?
while (int i <..)
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 37884
Swastik Dey wrote:is it valid?
while (int i <..)
Have you tried it?
Don't get me started about those stupid light bulbs.
subject: While loop execution
Similar Threads
Need help in data displaying
LinkedHashMap - trying to use the method removeEldestEntry
Dice probability program, using nested loops.
read next byte
Converting Number to Word