习题

package jjj;

public class b {
    public static void main(String[] args) {
        float f = 1.1f;//1.1在编译中默认是double类型,赋值给float需要转换,在数字后面加f;

        byte a = 0, b = 3;
        byte c = (byte) (a + b);//(a+b)默认是int类型

        short s = 23; s+=12; //s+=12  shout+=12
        s += 23;
        //s = s+12; //报错的int + shout

        System.out.println(Byte.MAX_VALUE);//8位 7位 2^7-1 = 127
        System.out.println(Byte.MIN_VALUE);// -2^7 = -128

        System.out.println(""+'a'+1);// 字符串+任何内容 结果都是字符串
        System.out.println('a'+1);//单个的字符

        int[] array = {'a','b',1,2};
        for (int i = 0;i

你可能感兴趣的:(习题)