單項選擇題

public void test(int x) { 
int odd = x%2; 
if (odd) { 
 System.out.println(“odd); 
} else { 
System.out.println(“even”); 
} 
} 
Which statement is true?() 

A.Compilation fails.
B. “odd” will always be output.
C. “even” will always be output.
D. “odd” will be output for odd values of x, and “even” for even values.
E. “even” will be output for add values of x, and “odd” for even values.

微信掃碼免費(fèi)搜題