I'm new at Java and I'm tryin to create a Login screen that prompts the user to enter a username and a password and then allows them into the program.
Is it true that I cant use the "switch" on a string and only if else statements?
If it is a string I can't use the !== or == to check if its equivalent.
Is this how it should be done?
Or must i create a boolean?
import java.io.*;
public class test
{
public void pass() throws Exception
{
// declaration
String username;
int id;
BufferedReader userInput=new BufferedReader (new InputStreamReader(System.in));
System.out.println("Enter Username");
username=userInput.readLine();
if (!.equals("lene");
System.out.println("Denied");
else (username.equals("lene");
}
do
{
System.out.print("Enter ID: ");
id=Integer.parseInt(userInput.readLine());
if (id!=123)
System.out.println("Denied");
}else((id==123));
}
}