| Author |
While loop execution
|
Varshini Priya
Ranch Hand
Joined: Feb 17, 2008
Posts: 83
|
|
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 Demowhile.java
Demowhile.java:7: '.class' expected
while (int i < 10)
^
Demowhile.java:12: ')' expected
}
^
2 errors
the code in line 7 & 12 looks fine. Please assist
|
 |
Swastik Dey
Ranch Hand
Joined: Jan 08, 2009
Posts: 1195
|
|
Its a syntax error, should be
while (i < 10)
|
Swastik
|
 |
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)
or
|
be a well encapsulated person, don't expose your privates, unless you public void getWife()!
|
 |
Swastik Dey
Ranch Hand
Joined: Jan 08, 2009
Posts: 1195
|
|
is it valid?
while (int i <..)
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32689
|
|
Swastik Dey wrote:is it valid?
while (int i <..)
Have you tried it?
|
 |
 |
|
|
subject: While loop execution
|
|
|