Mr. Truncale - Robert E. Lee High School
  • Home
  • Digital Media
    • HTML
  • Video Game Design
  • Comp. Programming I
  • Comp. Programming II
  • AP Computer Science
  • 3D Printing
  • Teacher Resources
  • Contact Me

Java - String Methods Guess My Password


Create a new project called GuessMyPassword. This program will allow the user to guess the a password and will tell the user if they go it right or not:

REMEMBER:
You cannot use == when you are comparing Strings; you must use string1.equals(string2)
//SAMPLE CODE

//DECLARE VARIABLES
String password = "L33TH4X0R";
String guess;

//Ask the user for a guess (INPUT)

//PRINT OUT IF THE GUESS IT WRONG OR NOT

// Use if( ){ }else{ } statement
// You cannot use == when you are comparing Strings; you must use string1.equals(string2)
TURN IN

Powered by Create your own unique website with customizable templates.