当前位置: 技术问答>java相关
scjp问题
来源: 互联网 发布时间:2015-04-03
本文导语: 1.what happens when we attempt to compile and run the following code? 2.public class Logic { 3.static long sixteen = 0x0010; 4.public static void main(String[] args) { 5.long N = sixteen>>4; 6.System.out.println("N=" + N); 7.} 8.} a)the compiler will ob...
1.what happens when we attempt to compile and run the following code?
2.public class Logic {
3.static long sixteen = 0x0010;
4.public static void main(String[] args) {
5.long N = sixteen>>4;
6.System.out.println("N=" + N);
7.}
8.}
a)the compiler will object to line 4 combining a long with int
b)the program will compile and run ,publicing the output "N=0"
c)the program will compile and run , publicing the output "N=1"
d)A runtime exception will be thrown
帮忙有谁能给我解释一下>>,>>>,是帶符號右移,>>>是不帶符號右移。
2.public class Logic {
3.static long sixteen = 0x0010;
4.public static void main(String[] args) {
5.long N = sixteen>>4;
6.System.out.println("N=" + N);
7.}
8.}
a)the compiler will object to line 4 combining a long with int
b)the program will compile and run ,publicing the output "N=0"
c)the program will compile and run , publicing the output "N=1"
d)A runtime exception will be thrown
帮忙有谁能给我解释一下>>,>>>,是帶符號右移,>>>是不帶符號右移。