public class _01_if {
public static void main(String[] args) {
//์กฐ๊ฑด๋ฌธ If
int hour = 15; //์คํ 3์
//if ๋ฌธ ๋ด์์ ํ๋์ ๋ฌธ์ฅ์ ์คํํ ๋๋ {} ์๋ต ๊ฐ๋ฅ
if(hour < 14)
System.out.println("์์ด์ค ์๋ฉ๋ฆฌ์นด๋
ธ +1");
//if ๋ฌธ ๋ด์์ 2๊ฐ ์ด์์ ๋ฌธ์ฅ์ ์คํํ ๋๋ {} ์๋ต ๋ถ๊ฐ
if(hour < 14) {
System.out.println("์์ด์ค ์๋ฉ๋ฆฌ์นด๋
ธ +1");
System.out.println("์ท ์ถ๊ฐ");
}
System.out.println(("์ปคํผ ์ฃผ๋ฌธ ์๋ฃ #1"));
//์คํ 2์ ์ด์ , ๋ชจ๋ ์ปคํผ๋ฅผ ๋ง์์ง ์์ ๊ฒฝ์ฐ?
hour = 10;
boolean morningCoffee = false; //๋ชจ๋ ์ปคํผ
//if(hour <14 && morningCoffee == false){
if(hour <14 && !morningCoffee){
System.out.println("์์ด์ค ์๋ฉ๋ฆฌ์นด๋
ธ +1");
}
System.out.println("์ปคํผ ์ฃผ๋ฌธ ์๋ฃ #2");
//์คํ 2์ ์ดํ์ด๊ฑฐ๋ ๋ชจ๋ ์ปคํผ๋ฅผ ๋ง์ ๊ฒฝ์ฐ?
hour =15;
morningCoffee = true;
if(hour >= 14 || morningCoffee == true){
System.out.println("์์ด์ค ์๋ฉ๋ฆฌ์นด๋
ธ (๋์นดํ์ธ) +1");
}
System.out.println("์ปคํผ ์ฃผ๋ฌธ ์๋ฃ #3");
}
}