3.数据类型

public class Demo3 {


    public static void main(String[] args) {
        //整数拓展
        int i1 = 0b10;
        int i2 = 010;
        int i3 = 0x1f;
        System.out.println(i1);
        System.out.println(i2);
        System.out.println(i3);
        //浮点数拓展

        float f = 0.1f;
        double d = 1.0/10;
        System.out.println(f==d);

        float d1 = 2333333333332333f;
        float d2 = d1+1;

        System.out.println(d1==d2);

        //字符拓展
        char c1 ='a';
        char c2 = '中';
        System.out.println(c1);
        System.out.println((int)c1);
        //所有字符本质是数字
        //编码 unicode 2字节 0-65536 Excel 2 16
        //U0000 UFFFF
        char c3 = '\u0061';
        System.out.println(c3);

        //转义字符 \t制表符 \n换行
        System.out.println("Hello\tWorld!");

        //
        String sa = new String("Hello World");
        String sb = new String("Hello World");
        System.out.println(sa==sb);
        String sc = "Hello World";
        String sd = "Hello World";
        System.out.println(sc==sd);
        //布尔值扩展
        boolean flag = true;
        if(flag==true){}
        if(flag)()
    }
}

你可能感兴趣的:(3.数据类型)