java基础重新巩固

public class Demo01 {
    public static void main(String[] args) {
        // 整数:进制    二进制0b   十进制     八进制0    十六进制0x

        int i = 0;
        int i2 = 010;   // 八进制  8
        int i3 = 0x10;  // 十六进制 16

        System.out.println(i);
        System.out.println(i2);
        System.out.println(i3);
        System.out.println("=============");

        // float
        // double
        // BigDecimal   数据类
        float f = 0.1f;
        double d = 0.1;
        System.out.println(f==d);   // false
        System.out.println(f);
        System.out.println(d);


        float d1 = 323423423534252342f;
        float d2 = d1 + 1;
        System.out.println(d1==d2); //true

        System.out.println("==================");
        char c1 = 'a';
        char c2 = '果';
        System.out.println(c1);
        System.out.println((int) c1);   // 97
        System.out.println(c1);
        System.out.println((int) c2);   // 26524
        // 字符本质是数字
        // 编码 Unicode   2字节     0-65535   2^16

        // U0000    UFFFF
        char c3 = '\u0061'; // Unicode表示。\表示转义
        System.out.println(c3); // a

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

        System.out.println("==================");
        String sa = new String("hello world");
        String sb = new String("hello world");
        System.out.println(sa==sb); // false
        String sc = "hello world";
        String sd = "hello world";
        System.out.println(sc==sd); // true
        // 对象 内存

        // boolean
        boolean flag = true;
        if (flag){}
    }
}
posted @ 2024-03-21 18:32  Jikeort  阅读(1)  评论(0编辑  收藏  举报