第8題 Given: 1. public class Spock{ 2. public static void main(String[] args){ 3. Long tail = 2000L; 4. Long distance = 1999L; 5. Long story = 1000L; 6. if((tail>distance) ^ ((story*2)==tail)) 7. System.out.print("1"); 8. if((distance+1 != tail) ^ ((story*2)==distance)) 9. System.out.print("2"); 10. } 11. } What is the result?
(A) 1
(B) 2
(C) 12
(D) Compilation fails.
(E) No output is produced. F. An exception is thrown at runtime.

答案:登入後查看
統計: A(32), B(26), C(34), D(68), E(133) #1157013

詳解 (共 2 筆)

#1652769
Jiao 幼稚園下 (2017/03...

(共 143 字,隱藏中)
前往觀看
10
0
#4178513

static String o = "";


public static void main(String[] args) {

Long tail = 2000L;

Long distance = 1999L;

Long story = 1000L;

if((tail>distance) ^ ((story*2)==tail))

System.out.print("1"); 

if((distance+1 != tail) ^ ((story*2)==distance))

System.out.print("2"); 

}

}

0
0