提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
比较if语句中的int值
class ComparisonDemo { /** from * N o w J a v a . c o m **/ public static void main(String[] args) { int value1 = 1; int value2 = 2; if (value1 == value2) System.out.println("value1 == value2"); if (value1 != value2) System.out.println("value1 != value2"); if (value1 > value2) System.out.println("value1 > value2"); if (value1 < value2) System.out.println("value1 < value2"); if (value1 <= value2) System.out.println("value1 <= value2"); } }