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

Robert E. Lee High School
1809 Market
Baytown, TX 77520
281-420-4535
digital media | computer programming I and II | BIM
ap computer science | architectural cad | video game design
national technical honor society | contact me