Results 1 to 3 of 3
Thread: Confused :?
- 10-17-2010, 08:31 PM #1
Confused :?
Well I just started to learn Java yesterday and I tried to compile a loop...
Java Code:public class DooBee { public static void main (String[] args) { int x = 1; While (x < 3) { System.out.print("Doo"); System.out.print("Bee"); x = x + 1; } if(x == 3) { System.out.print("Do"); } } }
... and it gave me an error saying ...
Java Code:DooBee.java:4: ';' expected While (x < 3) { ^
... however I made another loop previously ...
Java Code:public class Loopy { public static void main (String [] args) { int x = 1; System.out.println("Before the Loop"); while (x < 4) { System.out.println("In the loop"); System.out.println("Value of x is " + x); x = x + 1; } System.out.println("This is after the loop"); } }
.. and It didn't have any errors when it was compiled and there isn't a semicolon ...
Java Code:while (x < 4) { ^
.. there.
I know I'm a newbie, I just want to understand why this is happening. Can anyone explain this to me? Thanks! =)
- 10-17-2010, 08:34 PM #2
Senior Member
- Join Date
- Oct 2010
- Location
- Germany
- Posts
- 785
- Rep Power
- 12
While != while
- 10-17-2010, 08:38 PM #3
Similar Threads
-
I am confused
By prof.deedee in forum New To JavaReplies: 6Last Post: 10-31-2009, 12:32 AM -
Very confused Plz help!!
By ratb0y in forum NetBeansReplies: 0Last Post: 02-14-2009, 05:34 PM -
Confused
By coldfire in forum New To JavaReplies: 3Last Post: 01-13-2009, 02:00 PM -
confused
By updev in forum AWT / SwingReplies: 6Last Post: 11-14-2008, 04:33 PM -
what does it mean:confused:
By sivasayanth in forum New To JavaReplies: 2Last Post: 01-12-2008, 05:52 AM
Bookmarks