JAVA制御文-boolean、比較演算子
boolean
booleanデータ型にはtrue、falseの2つのデータがあり、真または偽を区別します.
public class BooleanApp {
public static void main(String[] args) {
String foo = "Hello world";
// ture와 false같은 컴퓨터언어에서 쓰임이 있는 단어는 변수로 사용불가능(reserved word라고 함)
// String true = "Hello world";
System.out.println(foo.contains("world")); //true
System.out.println(foo.contains("egoing")); //false
}
}
比較演算子
比較演算子は、左側の値と右側の値を比較し、結果に基づいてtrueまたはfalseを出力します.
<、>、=、>=、<=などの記号があります.
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
}
}
Reference
この問題について(JAVA制御文-boolean、比較演算子), 我々は、より多くの情報をここで見つけました https://velog.io/@cksgh989/booleanテキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol