byte取负数,int用0xff表示

package com.web;

public class Test57 {
    
    
    public static void main(String[] args) {
    
    
        byte a = -128;
        byte b = (byte) 0xff;
        System.out.println("b = " + b);//b = -1
        int i = 0xff;
        System.out.println("i = " + i);//i = 255
    }
}

猜你喜欢

转载自blog.csdn.net/djydjy3333/article/details/121558017
今日推荐