Exercise
Password as string
Objetive
Write a java program to ask the user for their username and password (both should be strings) and repeat it as many times as necessary until the entered name is "username" and the password is "password".
Example Code
import java.util.*;
public class Main
{
public static void main(String[] args)
{
String user, password;
do
{
System.out.print("Enter a user: ");
user = new Scanner(System.in).nextLine();
System.out.print("Enter a password: ");
password = new Scanner(System.in).nextLine();
} while (!user.equals("user") && !password.equals("password"));
System.out.println("Bye!");
}
}