i started learning java yesterday and its my first programming language to learn. ive covered most of the basics and such but im stuck at one thing
i have a program written that asks for a password
i want it to compare the user input to the actual password using an if statement.
heres what i have so far
import java.util.Scanner;
public class UserInput {
public static void main(String[] args) {
System.out.println("Please Enter Your Name");
Scanner name = new Scanner (System.in);
String inName = name.nextLine();
System.out.println("Welcome " + inName);
System.out.println("Please enter your password");
Scanner password = new Scanner (System.in);
String inPassword = password.nextLine();
if (inPassword.equals(password1)) {
// i get an error here
//ive tried making a string for the actual password but nothing seems to work
System.out.println("access granted");
} else {
System.out.println("access denied");
}
}
}