if ("Submit".equals(cmd)) { //Process the password. String UserNameInput=UserName.getText(); ///////////////////////////////ERROR Pin when printed shows error///////////////////////////// char[] PinInput = PinField.getPassword(); String pinInput=PinInput.toString(); //for debugging , print PinInput , but it prints garbage System.out.println("Pin entered is "+PinInput); //pinInput has garabage instead of the Pin that was entered //so the function isPasswordCorrect fails to verify UserName & Pin if (isPasswordCorrect(UserNameInput,pinInput)) { //some tasks } } boolean isPasswordCorrect(String Username,String Pin) { //verify username & pin }
I need to convert PinInput from an array of characters to String, so that I can use the isPasswordCorrect () function. When I use the toString () method, it produces a value for garbage, what do I need to do to convert the PinInput value to String?
source share