Hi !
I want to make a console window program which take a password from window and compare it with a predefined password and then will show password match or not match.
my code is where which is compiling and running too.
But the problem is that when i am taking password input(wrong or correct password in both) from console its always showing result "not match" . please help me
here is the code
import java.io.Console; public class Main { public static void main(String[] args) { Console console = System.console(); char[] passwordArray={'s'}; char[] passwordArray2 = console.readPassword("Enter your secret password: "); if((passwordArray==passwordArray2)) { console.printf("Match\n"); } else { console.printf("not Match"); } } }