시작 전

제어문 - 연산자

꿈꾸는야오옹 2022. 7. 7. 14:04
public class AuthApp2 {

	public static void main(String[] args) {
		
		 System.out.println(args[0]);
		 
		 String id = "ujin";
		 String inputId = args[0]; // 1번째 입력값 ujin
		 
		 String pass = "3153";
		 String inputPass = args[1];  // 2번째 입력값 3150
		 
		 System.out.println("Hi.");
		 
		 
		 if(inputId.equals(id) && inputPass.equals(pass) ) {      // equals
			 System.out.println("Master!");
			 
		 }
		 else {
			 System.out.println("Who are u?");
		 }

	}

}  //ujin
   //  Hi.
   //Who are u?

&& 는 and 연산자

|| 는 or 연산자

! 는 not 연산자

 

원시데이터 타입은 == , 그 이외는 equals 사용