Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2014
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.78 KB | None | 0 0
  1.         String guess = "java";
  2.         String answer;
  3.        
  4.         answer = JOptionPane.showInputDialog(null, "Guess what i am");
  5.        
  6.         if ("java".equals(answer))
  7.         {
  8.             JOptionPane.showMessageDialog(null, "you guessed right the first time");
  9.         }
  10.         else
  11.         {
  12.            
  13.             answer = JOptionPane.showInputDialog(null, "Take a second guess");
  14.            
  15.             if ("java".equals(answer))
  16.             {
  17.                 JOptionPane.showMessageDialog(null, "you guessed right the second time");
  18.             }
  19.             else
  20.             {
  21.                 answer = JOptionPane.showInputDialog(null, "take a third guess");
  22.                 if("java".equals(answer))
  23.                 {
  24.                     JOptionPane.showMessageDialog(null, "you got it right on your 3rd guess");
  25.                 }
  26.                 else
  27.                 {
  28.                     JOptionPane.showMessageDialog(null, "3rd Wrong guess\nClue: i have 3 editions");
  29.                        
  30.                 }  
  31.             }      
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement