SOMEDAY/JAVA
[JAVA] 2-1~3 Boolean type , false true , 비교연산자
아이엠제니
2022. 2. 1. 07:10

부스트코스 생활코딩 [쉽게 배우는 자바2] 공부 기록
시작
2022. 1. 31. ~
제어문
2-1 수업소개
2-2 Boolean data type
0 또는 1 , false or true
package javaChapter2_1;
public class BooleanApp {
public static void main(String[] args) {
System.out.println(("One")); // String
System.out.println(1); // int
System.out.println(true);
System.out.println(false);
String foo = "Hello world";
// String true = "Hello world"; // reserved word (예약어)
System.out.println(foo.contains("world"));
System.out.println(foo.contains("egoing"));
}
}

2-3 비교연산자 (Comparison Operator)
package javaChapter2_1;
public class ComparisonOperatorApp {
public static void main(String[] args) {
System.out.println(1 > 1); // false
System.out.println(1 == 1); // true
System.out.println(1 < 1); //false
System.out.println(1 >= 1); //true
}
}

비교연산자: > , < , >= , <= , == , !=
300x250