C++和Java的关系运算语句?
编译一下C++代码:
1 #include <iostream> 2 3 int main(void) 4 { 5 int iTest = 0; 6 ( 10 < 9 ) && iTest++; 7 std::cout << "iTest is " << iTest << std:; 8 9 return 0; 10 }
可以直接编译成功。但是编译以下Java代码:
1 class Hello 2 { 3 public static void main(String[] args) 4 { 5 int iTest = 0; 6 (10 > 9) && iTest++; 7 System.out.println("iTest is " + iTest); 8 } 9 }
却提示错误:
[tortoise@sea temp]$ javac Hello.java Hello.java:6: not a statement (10 > 9) && iTest++; ^ 1 error [tortoise@sea temp]$