public class Test1 {
public static void main(String[] args) {
System.out.println(~2);
}
}
2转成2进制为 010 取反计算后 应该为 101
为什么结果为 -3
public class Test1 {
public static void main(String[] args) {
System.out.println(~2);
}
}
2转成2进制为 010 取反计算后 应该为 101
为什么结果为 -3
2=0000....10(32位)
~2=1111.....01(32位)
=-3
有帮助望采纳