Saturday 15 February 2014

java - delay when typing input while using scanner -


When I enter string variables b and p , I enter Have not clicked the key several times

After this point, the program prints only inside the other statement that is printed out. The only string variable that is responding to the program is j .

Code:

  Package is valid; Import java.util.Scanner; Public class gaming {public static zero main (string agre []) {scanner sc = new scanner (system.); String J = "Well, how are you?"; String b = "good"; String p = "bad"; System.out.println ("Hello, my name is Julie robot"); System.out.println ("How are you?"); If (j.equals (sc.nextLine ()) {System.out.println ("Im doing great!"); } Else if (b.equals (sc.nextline ()) {System.out.println ("Dude's Great! :)"); } Else if (p.equals (sc.nextLine ()) {System.out.println ("Not Good"); } Else {System.out.println ("I see ..."); }    

Do you know that every time you type sc.nextLine ( ) Are you asking the user for new input?

If your if s and the store try to use it one time before receiving the input in value, then use that value in the circumstances < / Div>

No comments:

Post a Comment