我試圖編譯和運行下面的代碼爲什麼java int允許使用|運營商?它如何評估?
public static void main(String... args) {
int x = 1 | 2 | 3 | 4;
//int x = 1 | 1 | 1 ;
//int x = 1 | 2 ;
//int x = 2 | 1 ;
System.out.println(x);
}
我點網試圖和它不工作如何在Java來它的工作?這個代碼如何評估以產生答案?
你期望得到什麼? – johnchen902
OR-ing整數無法使用什麼未標註的.NET語言? – EJP
這是一個按位或運算。 3 | 4 = 7 http://stackoverflow.com/questions/3312611/operator-in-java – david99world