Advertisement
007chill

Untitled

Oct 26th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. import java.util.Random;
  2. import java.util.Scanner;
  3. public class Question11 {
  4. public static void main(String[] args)
  5. {
  6. Scanner keyboard = new Scanner(System.in);
  7. boolean isTrue = false;
  8. String password = "happy";
  9. String correctpass=" ";
  10.  
  11. while (isTrue==false)
  12. {
  13. System.out.println("Please enter a password: ");
  14. correctpass = keyboard.next();
  15. if(correctpass.equals(password))
  16. {
  17. isTrue=true;
  18. }
  19. }
  20. System.out.println("Correct!");
  21. }
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement