논리적질문 내용을 변수에 담을 수 있음
// 변수 만들면 간단해짐
boolean isRightPass = ( inputPass.equals(pass) || inputPass2.equals(pass2) ) ;
if ( inputId.equals(id) && isRightPass )
import java.util.Scanner;
public class AuthApp2 {
public static void main(String[] args) {
String id = "hyun" ;
Scanner in = new Scanner (System.in) ;
System.out.print("Id?: ");
String inputId = in.next() ;
String pass = "1111" ;
String pass2 = "2222" ;
System.out.print("password?: ");
String inputPass = in.next() ;
System.out.print("2nd password?: ");
String inputPass2 = in.next() ;
boolean isRightPass = ( inputPass.equals(pass) || inputPass2.equals(pass2) ) ; // 변수 만들면 간단해짐
if ( inputId.equals(id) && isRightPass ) {
System.out.println("Hi! " + inputId );
} else {
System.out.println("WRONG ID or PASSWORD!");
}