Results 1 to 3 of 3

Thread: Confused :?

  1. #1
    jESTPHROSTY's Avatar
    jESTPHROSTY is offline Member
    Join Date
    Oct 2010
    Location
    360 WA
    Posts
    2
    Rep Power
    0

    Question 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! =)

  2. #2
    eRaaaa is offline Senior Member
    Join Date
    Oct 2010
    Location
    Germany
    Posts
    787
    Rep Power
    5

    Default

    While != while

  3. #3
    jESTPHROSTY's Avatar
    jESTPHROSTY is offline Member
    Join Date
    Oct 2010
    Location
    360 WA
    Posts
    2
    Rep Power
    0

    Default

    /facepalm

    I accidentally capitalized the W in 'while'. Sorry, now I feel like an idiot -.-. Thanks though!

Similar Threads

  1. I am confused
    By prof.deedee in forum New To Java
    Replies: 6
    Last Post: 10-30-2009, 11:32 PM
  2. Very confused Plz help!!
    By ratb0y in forum NetBeans
    Replies: 0
    Last Post: 02-14-2009, 04:34 PM
  3. Confused
    By coldfire in forum New To Java
    Replies: 3
    Last Post: 01-13-2009, 01:00 PM
  4. confused
    By updev in forum AWT / Swing
    Replies: 6
    Last Post: 11-14-2008, 03:33 PM
  5. what does it mean:confused:
    By sivasayanth in forum New To Java
    Replies: 2
    Last Post: 01-12-2008, 04:52 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •