Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: Is "count" in this loop a keyword?

  1. #1
    Junior Member
    Join Date
    Sep 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Is "count" in this loop a keyword?

    class WhileDemo {
        public static void main(String[] args){
            int count = 1;
            while (count < 11) {
                System.out.println("Count is: "
                                   + count);
                count++;
            }
        }
    }


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Is "count" in this loop a keyword?

    You tell us. What do you think? What exactly do you mean by "keyword"?
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Junior Member
    Join Date
    Apr 2012
    Posts
    17
    My Mood
    Stressed
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Re: Is "count" in this loop a keyword?

    if you mean key words in the java syntax like while,for,if,switch and so on then no it is'nt because it is created by you, if you are using an IDE, all the java key words will be illistrated by bold text and a change of font colour, in eclipse this would be purple. the key word in your code would be while.

    hope that helped,

  4. #4
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Is "count" in this loop a keyword?

    Quote Originally Posted by DanielJamesCollier View Post
    if you mean key words in the java syntax like while,for,if,switch and so on then no it is'nt because it is created by you, if you are using an IDE, all the java key words will be illistrated by bold text and a change of font colour, in eclipse this would be purple. the key word in your code would be while.

    hope that helped,
    The color of the text depends on the settings, and is a pretty poor way to identify the keywords, imo. Also, that program contains several such keywords, not just "while". Also also, this seems like a homework assignment to me, so be careful not to just do somebody else's homework for them.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  5. #5
    Junior Member
    Join Date
    Sep 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Is "count" in this loop a keyword?

    I think I get it now
    int "count" is created and set it to 1, then if count is less than 11 print text to screen......plus the count, increase count by 1.
    Also this isn't homework, it's an example from the tutorials.
    The while and do-while Statements (The Java™ Tutorials > Learning the Java Language > Language Basics)

  6. #6
    Junior Member
    Join Date
    Apr 2012
    Posts
    17
    My Mood
    Stressed
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Re: Is "count" in this loop a keyword?

    Sory from now on I'll support people to work it out for them selfs with a few hints

Similar Threads

  1. Count number of 'coin'p coins in a "machine"
    By BITmixit in forum What's Wrong With My Code?
    Replies: 0
    Last Post: March 20th, 2012, 04:34 PM
  2. Replies: 3
    Last Post: December 7th, 2011, 02:03 AM
  3. Replies: 7
    Last Post: August 13th, 2011, 01:22 AM
  4. Why do we use the "this" keyword?
    By EmSaint in forum Object Oriented Programming
    Replies: 1
    Last Post: November 1st, 2010, 08:28 PM
  5. "java.lang.NoSuchMethodError: main" and "fatal exception occured."
    By joachim89 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: January 10th, 2010, 08:35 AM