Ricardo F.
New Member
- Joined
- Jun 19, 2011
- Messages
- 1
- Reaction score
- 0
- Points
- 1
import java.io.*;
class pass {
public static void main(String args[]){
System.out.print("Enter Password ");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String pass = null;
try{
pass = br.readLine();
} catch(IOException e){
System.out.print("error");
System.exit(1);
}
System.out.print("Re-type password: ");
BufferedReader bro = new BufferedReader(new InputStreamReader(System.in));
String retypePass = null;
try {
retypePass = bro.readLine();
} catch(IOException e) {
System.out.print ("Error");
System.exit(1);
} if (pass == retypePass) System.out.print("Success"); else System.out.print("Fatal");
}
}
So when I type the same "password" the system ouptut gives me a "fatal" and I want that when i write the same the console output gives me a "success"look this is the "error";
--------------------Configuration: pass - JDK version 1.6.0_25 <Default> - <Default>--------------------
Enter Password h
Re-type password: h
Fatal
Process completed.
In this case i wrote the same and the console output "fatal" and its supposed to be "success"
Thanks!!
class pass {
public static void main(String args[]){
System.out.print("Enter Password ");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String pass = null;
try{
pass = br.readLine();
} catch(IOException e){
System.out.print("error");
System.exit(1);
}
System.out.print("Re-type password: ");
BufferedReader bro = new BufferedReader(new InputStreamReader(System.in));
String retypePass = null;
try {
retypePass = bro.readLine();
} catch(IOException e) {
System.out.print ("Error");
System.exit(1);
} if (pass == retypePass) System.out.print("Success"); else System.out.print("Fatal");
}
}
So when I type the same "password" the system ouptut gives me a "fatal" and I want that when i write the same the console output gives me a "success"look this is the "error";
--------------------Configuration: pass - JDK version 1.6.0_25 <Default> - <Default>--------------------
Enter Password h
Re-type password: h
Fatal
Process completed.
In this case i wrote the same and the console output "fatal" and its supposed to be "success"
Thanks!!