Why this code return "Granted" even with different passwords?
class ImportantRoom{ char roomID; int password; String roomCode = (this.roomID + "" + this.password); void open(String userCode){ if(userCode.equals(this.roomCode)){ System.out.println("Granted."); } else { System.out.println("Denied."); } } } class UserCard{ String userName; char userRoom; int password; String userCode = (this.userRoom + "" + this.password); } public class ClosedDoor{ public static void main(String[] args){ ImportantRoom r1 = new ImportantRoom(); r1.roomID = 'b'; r1.password = 4321; UserCard c1 = new UserCard(); c1.userName = "Jonas"; c1.userRoom = 'b'; c1.password = 4322; r1.open(c1.userCode); //The passwords are different but... //the code return "Granted" and I donÂŽt know why... } }