Question: why am i getting this error: error: cannot find symbol if((username==user_name) && (password == hashed_password)) ^ symbol: variable password location: class cooperbooks 2 errors cooperbooks.java:119:
why am i getting this error:
error: cannot find symbol if((username==user_name) && (password == hashed_password)) ^ symbol: variable password location: class cooperbooks 2 errors cooperbooks.java:119: error: cannot find symbol if((username==user_name) && (password == hashed_password)) ^ symbol: variable username location: class cooperbooks cooperbooks.java:119: error: cannot find symbol if((username==user_name) && (password == hashed_password)) ^ symbol: variable password location: class cooperbooks
here is my code
while(result.next()) { user_name = result.getString(1); if (result.wasNull()) { user_name = null; } //if
hashed_password = result.getString(2);
if (result.wasNull()) { hashed_password= null; } // if
// Enter your user name and password String username = new String(); String password= new String(); System.out.println("Enter Username"); username=input.nextLine(); System.out.println ("Enter password"); password= input.nextLine(); // if statement to check if the user name and password is valid } if((username==user_name) && (password == hashed_password)) { System.out.println("Log is invalid"); // System.out.println(" do want to be a member, Yes or No ?"); // decision=input.nextLine();
} else { System.out.println("Welcome Member"); //System.out.println("Select option"); //displayMenu(); } // while }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
