Am I supposed to add another } at the end of the file?
import java.io.*;
public class rshg {
public static void main(String[] args){
BufferedReader userInput=new BufferedReader (new InputStreamReader(System.in));
String username;
int password;
System.out.println("Enter Username:");
username=userInput.readLine();
if (username!="lene") {
System.out.println("Wrong Username");
}else{
username=userInput.readLine();
if (username=="lene") {
System.out.println("Enter Password");
password=userInput.readLine();
if (password!=123){
System.out.println("Wrong Password");
}else{
System.out.println("Success");
}
}
}
2007-11-08
01:12:42
·
5 answers
·
asked by
Junkie
1
in
Computers & Internet
➔ Programming & Design
Thank you for your replies, much appreciated!
But what if I need a NOT equals to? For the first portion,
username=userInput.readLine();
if (username!="lene") {
Would it be a
"if (username.!equals("lene")) {
With the !...?
2007-11-08
03:09:44 ·
update #1