(Input) Username. Password Billy. 1234 Tony. 5653
(Output) What's the user name ? Billy What's the password 1234 Access granted
How would I create a input data that will have a user name and password,then how would I get it to reset screen and say (welcome "Username")
Thanks
The best answer for this question is to go throw a simple java input/output program, just google it. However, I would recommend you to check this tutorial.
From that tutorial - lesson - the following code will fulfill your request:
import java.io.* ;
class Tut1 {
public static void main(String args[])
{
InputStreamReader istream = new InputStreamReader(System.in) ;
BufferedReader bufRead = new BufferedReader(istream) ;
System.out.println("Welcome To My First Java Program");
try {
System.out.println("What is the username?");
String username= bufRead.readLine();
System.out.println("What is the password?");
String password = bufRead.readLine();
//if(username.equal("**") && password.equal("**")){
System.out.println("Access Granted");
//To clear screen
System.out.print("\033[H\033[2J");
System.out.flush();
System.out.println("Welcome\""+ username +"\"");
//}
}
catch (IOException err) {
System.out.println("Error reading line");
}
}
}