java认证题目不懂
Exhibit :
1. public class test (
2. private static int j = 0;
3.
4. private static boolean methodB(int k) (
5. j += k;
6. return true;
6. )
7.
8. public static void methodA(int i) {
9. boolean b:
10. b = i < 10 | methodB (4);
11. b = i < 10 || methodB (8);
12. }
13.
14. public static void main (String args[] ) (
15. methodA (0);
16. system.out.printIn(j);
17. )
18. )
What is the result?
A. The program prints “0”
B. The program prints “4”
C. The program prints “8”
D. The program prints “12”
E. The code does not complete.
答案: B
为什么是B我觉的是D
b=i<10|methodB(4)
是两边都要执行的
b=i<10||methodB(8)
这个虽然是短路运算符但,0<10是true,还是要计算methodB(8)的
那为什么是B??
Which two demonstrate an “is a” relationship? (Choose Two)
A. public interface Person { }
public class Employee extends Person { }
B. public interface Shape { }
public class Employee extends Shape { }
C. public interface Color { }
public class Employee extends Color { }
D. public class Species { }
public class Animal (private Species species;)
E. interface Component { }
Class Container implements Component (
Private Component[ ] children;
)
答案: D, E
为什么
雇员是人类,但人类不全是雇员我觉的是对的,为什么呢??
谢谢了