fork download
  1. import java.util.*;
  2. public class SecretPhraseFINAL {
  3. public static void main(String[] args)
  4. {
  5. Scanner stdIn = new Scanner(System.in);
  6. boolean phraseInput = false;
  7. int count = 0;
  8. String secret;
  9. String template = "";
  10. String guess;
  11.  
  12.  
  13. do
  14. {
  15. System.out.println("Enter a secret phrase to be guessed: ");
  16. secret = stdIn.nextLine();
  17. secret = secret.toLowerCase();
  18. if(secret.length() < 1)
  19. System.out.println("This is an invalid response!");
  20. else
  21. {
  22. System.out.println("The secret phrase has been chosen!");
  23. phraseInput = true;
  24. }
  25. }while(phraseInput = false);
  26.  
  27. //Make my template to compare to
  28. for(int i = 0; i < secret.length(); i++)
  29. {
  30. if(secret.charAt(i) == ' ')
  31. template += " ";
  32. else
  33. template += "?";
  34. }
  35.  
  36. do
  37. {
  38. System.out.println("The secret phrase is:\n" + template); //Display the template.
  39. System.out.println("Enter your guess: ");
  40. guess = stdIn.next();
  41.  
  42.  
  43. }
  44.  
  45. }
  46.  
  47. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:43: error: while expected
		}
		 ^
Main.java:47: error: illegal start of expression
}
^
Main.java:47: error: reached end of file while parsing
}
 ^
3 errors
stdout
Standard output is empty