説明
左側の変数と右側の値または変数を比較します。左側のオペランドが右側のオペランドより大きいとき、または等しいときに真を返します。異なるデータ型の変数を比較することもできますが、予測できない結果を生む可能性があります。符号付き/非符号付きを含む同じデータ型の変数を比較することをお勧めします。
構文
1 |
x >= y; // is true if x is bigger than or equal to y and it is false if x is smaller than y |
y: 変数または定数。許可されたデータタイプ:int、float、double、byte、short、long。
プログラム例
1 2 3 |
if (x >= y) { // tests if x is greater (bigger) than or equal to y // do something only if the comparison result is true } |
注意点と警告
正の数は負の数よりも大きい。