来,来,来,看一看呀。。。
Consider the following piece of code, and select all relevant statements:
1. class Test{
2. public static void main(String [] args){
3. aMethod();
4. }
5.
6. static void aMethod(){
7. try{
8. System.out.println("abcd");
9. return;
10. } finally { //try后面一定要有catch吗,没有就报错???
11. System.out.println("1234");
12. }
13. }
14.}
-------------------------------------------------------------------
elect ALL valid answers...
Which of the following statements are valid, given the following variable declarations: boolean a; boolean b; int c;
(a | b)
(a || a)
(a ^ b) | c
(a & c)
(a && c)
BOOLEAN值可以进行& / ^ / | 运算? //一个BOOLEAN的每位值是多少,怎么按位运算?
摘自THINK IN JAVA ,,,
我们将boolean(布尔)类型当作一种“单位”或“单比特”值对待,所以它多少有些独特的地方。我们可执行按位AND,OR和XOR,但不能执行按位NOT(大概是为了避免与逻辑NOT混淆)。对于布尔值,按位运算符具有与逻辑运算符相同的效果,只是它们不会中途“短路”。此外,针对布尔值进行的按位运算为我们新增了一个XOR逻辑运算符,它并未包括在“逻辑”运算符的列表中。在移位表达式中,我们被禁止使用布尔运算.