符号:
> 大于;
< 小于;
>=大于等于;
<=小于等于;
==等于;
!=不等于;
实例代码:
package com.java1234.chap02; public class Demo10 { public static void main(String[] args) { int a=2; int b=3; // >大于 System.out.println(a+">"+b+":"+(a>b)); // <小于 System.out.println(a+"<"+b+":"+(a<b)); // >=大于等于 System.out.println(a+">="+b+":"+(a>=b)); // <=小于等于 System.out.println(a+"<="+b+":"+(a<=b)); // ==等于 System.out.println(a+"=="+b+":"+(a==b)); // !=不等于 System.out.println(a+"!="+b+":"+(a!=b)); } }