if (Boolean_expression) && (Boolean)
{
statement_1
}
else if (Boolean_expression) // (Boolean)
{
statement_2
}
else
{
statement_3
}
char grade;
int score = scanner.nextInt();
switch (score/10 // char, int, short, byte, String) {
case 10:
case 9:
grade = 'A';
break;
case 8:
grade = 'B';
break;
case 7:
grade = 'C';
break;
...
default:
grade = 'F';
}
System.out.println("학점은" + grade + "입니다.");
int x = 5;
int y = 3;
int s;
if (x > y)
s = 1;
else
s = -1;
아래와 동일!!
int s = (x > y) ? 1 : -1 ;
== !=. > >= < <=
String str1 = "Korea"
String str2 = str1 ;
String str3 = "Korea";
String str4 = new String("Korea");
String str5 = "KOREA";
str1 == str2 // T
str1 == str3 // T
str1 == str4 // F
str1 == str5 // F
str1.equals(str4) // T
str1.equalsIgnoreCase(str5) // T
사전식 뒤에있으면 양수
String str1 = "adventure123";
str1.compareTo("zoo"); // 음수
str1.compareTo("adventure123"); // 0
str1.compareTo("5555"); // 양수
str1.compareTo("above") // 양수
str1.compareTo("ADVENTURE123"); // 양수
str1.compareToIgnoreCase("ADVEnture123"); // 0