Results 1 to 3 of 3

Thread: Infinite Loop

  1. #1
    jdodle is offline Member
    Join Date
    Oct 2013
    Posts
    11
    Rep Power
    0

    Default Infinite Loop

    I am having a strange problem with a for loop I am using here it is:

    Java Code:
    System.out.println("hello");
    			
    			for (int i = 0; i < 50; i++) {
    				
    				for (int j = 0; j < 80; j++) {
    					
    					if (chunk[i][j] == '+') {
    						
    						chunk[i][j] = '#';
    					}
    				}
    			}
    the print statement above the loop is used to make sure the infinite loop did not occur before this point, and when I commented this loop it ran fine, so it is definitely this loop that goes infinite. HOWEVER, their are counters that increase each time no mater what, so why is it going infinite?

  2. #2
    allaudin's Avatar
    allaudin is offline Senior Member
    Join Date
    Apr 2013
    Posts
    271
    Rep Power
    0

    Default Re: Infinite Loop

    it shouldn't be infinite :) write whole source code

  3. #3
    jdodle is offline Member
    Join Date
    Oct 2013
    Posts
    11
    Rep Power
    0

    Default Re: Infinite Loop

    Yes your right I found the problem after I realized my prints didn't really prove what I though they did. Thanks anyway!

Similar Threads

  1. Infinite loop
    By jyde001 in forum Java Applets
    Replies: 4
    Last Post: 08-09-2012, 02:13 AM
  2. infinite loop
    By javapink in forum New To Java
    Replies: 19
    Last Post: 03-06-2011, 03:28 AM
  3. how to end infinite loop
    By search4survival in forum New To Java
    Replies: 14
    Last Post: 10-25-2010, 09:59 AM
  4. Infinite loop
    By jDennis79 in forum New To Java
    Replies: 7
    Last Post: 08-14-2010, 12:45 AM
  5. Infinite Loop
    By rclausing in forum New To Java
    Replies: 2
    Last Post: 01-23-2010, 11:11 PM

Posting Permissions

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