public class Test1 {
    public static void main(String[] args) {
        byte b1=40;
        byte b=(byte) 128;
        System.out.println(b1);
        System.out.println(b);
    }
}
输出是
40
-128
第一个输出是40我理解但第二个输出-128怎么可能?是否有可能因为它超出了它的范围?如果是,它在字节转换后如何工作...帮助我
Byte byte1=new Byte("10");
Byte byte2=Byte.valueOf("10");
System.out.println(byte1);
System.out.println(byte2);
byte1和byte2都打印相同的值10.然后构造函数参数化的Byte和valueOf()方法之间的区别是什么.
我需要在这里将字符转换为int类型的原因是什么:
Integer integer= (int) 'a';
但我不需要在这里施放:
int i='a';
Byte byte1=new Byte((byte) 20);
Short short1=new Short((short) 20);
为什么我必须在Byte和Short中使用强制转换操作符,但我没有在其他DataType中使用强制转换操作符
Integer integer=new Integer(20);
Long long1=new Long(20);
Double double1=new Double(20);
Float float1=new Float(20);