Preview:
String password = "let me in";
Scanner scanner = new Scanner(System.in);
String guess;

do
{
  System.out.println("Guess the password:");
  guess =  scanner.nextLine();
}while(!guess.equals(password);
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter