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 2 of 2

Thread: counter not incrementing within for loop - please help!!!

  1. #1
    Member
    Join Date
    Feb 2013
    Location
    earth
    Posts
    88
    Thanks
    12
    Thanked 9 Times in 9 Posts

    Default counter not incrementing within for loop - please help!!!

    .


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,265
    Thanks
    56
    Thanked 2,372 Times in 2,343 Posts

    Default Re: counter not incrementing within for loop - please help!!!

    doesn't seem to be incrementing within the program
    Is the counter++; statement ever executed? If not, then the value of counter will stay at 0.
    Add a call to println() next to that statement to see if it is ever executed.

    You should use the equals() method to compare the contents of objects like Strings, not the == operator.
    If you don't understand my answer, don't ignore it, ask a question.

  3. The Following User Says Thank You to Norm For This Useful Post:

    javaiscool (February 8th, 2013)

Similar Threads

  1. [SOLVED] Help with the incrementing in a For loop
    By gabie1121 in forum Loops & Control Statements
    Replies: 2
    Last Post: October 26th, 2012, 12:55 PM
  2. Problems with incrementing/decrementing in a for loop..
    By kl2eativ in forum What's Wrong With My Code?
    Replies: 18
    Last Post: June 13th, 2011, 06:15 AM
  3. Help with counter controlled while loop please!
    By rockout341 in forum Loops & Control Statements
    Replies: 3
    Last Post: March 15th, 2011, 03:41 PM
  4. Return from incrementing for loop?
    By mindlessn00b in forum Loops & Control Statements
    Replies: 16
    Last Post: October 4th, 2010, 01:15 PM
  5. Return from incrementing for loop HELP?!
    By mindlessn00b in forum What's Wrong With My Code?
    Replies: 0
    Last Post: October 3rd, 2010, 03:36 PM

Tags for this Thread