File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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: 94

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: 1528

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: 1528

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

Joined: Oct 13, 2005
Posts: 45364
Swastik Dey wrote:is it valid?
while (int i <..)
Have you tried it?
Consider Paul's rocket mass heater.
subject: While loop execution
jQuery in Action, 3rd edition