Results 1 to 2 of 2

Thread: Confusing Error

  1. #1
    CODinacup is offline Member
    Join Date
    Sep 2012
    Posts
    13
    Rep Power
    0

    Default Confusing Error

    I do not get an error when i comment out the while loop, but as soon as i uncomment it i get an error.

    Java Code:
      public void history2()
       {
    	   Boolean cont;
    	   cont = true;
    	   while( cont == true ){
          int bet = inputInt("Daily Double!"+"\n"+"Please input your bet:");
         if( bet >= score){
           output( "Please input a valid bet." );
           cont = true;    
          }
         else{ cont = false; }
          
        	  }
          String guess = inputString("What is my favorite color?");
          if ( 
              guess.equalsIgnoreCase( "red" )
              || guess.equalsIgnoreCase( "blue" ))
          {
             score = score + bet;
             output("Right!");
          bHistory2.setEnabled(false);
          }
          else
          {  
             score = score - bet;         
             output("Wrong... Try Again " ); 
          }      
       }

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Confusing Error

    It usually helps to tell us what the error is so we don't have to guess. Better still, to post the entire error message. Also, please use proper and consistent indentation. It's hard enough trying to understand someone else's code that you shouldn't make it harder with indentation that's randomly placed. Indent each block 3 spaces (no tabs), and all code lines within the same block should begin at the same column.

Similar Threads

  1. A very confusing question
    By JohnPringle83 in forum New To Java
    Replies: 3
    Last Post: 05-08-2011, 07:29 AM
  2. confusing ques
    By rok0016 in forum New To Java
    Replies: 6
    Last Post: 07-15-2010, 06:07 PM
  3. Confusing input question
    By jigglywiggly in forum New To Java
    Replies: 1
    Last Post: 03-13-2009, 04:38 AM
  4. Confusing IndexOutOfBounds Error?
    By tibbyuk in forum New To Java
    Replies: 2
    Last Post: 08-08-2008, 11:42 PM
  5. Confusing with Frameworks
    By hisouka in forum New To Java
    Replies: 0
    Last Post: 08-05-2008, 05: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
  •