0

I need help to login account using String Array. Thanks!

import java.util.Scanner; public class dummy { public static void main(String [] args){ Scanner sc = new Scanner(System.in); String [] user = {"Yui1" , "Yui2" , "Yui3"}; String [] pass = {"Pass" , "Pass1" , "Pass2"}; String userName; do{ System.out.print("Enter your username: "); //I do not know how to scan String [] user System.out.print("Enter your pass " ); //same here if(user.equals("Yui1") && pass.equals("Pass")){ System.out.print("Successfully login!"); }else if(user.equals("Yui2") && pass.equals("Pass1")){ System.out.print("Successfully login!"); }else if(user.equals("Yui3") && pass.equals("Pass2")){ System.out.print("Successfully login!"); }else{ System.out.print("The username or password does not match "); } System.out.print("Try again"); }while() } }

17th Sep 2018, 7:00 PM
Reginald Tobias
Reginald Tobias - avatar
1 Antwort