java基础

谁说胖子不能爱 提交于 2020-02-26 18:47:07

public class Demo02 {
    public static void main(String[] args) {
        // 整数扩展: 进制  二进制0b  十进制  八进制0  十六进制0x
        int i=11;
        int i2=045;//八进制
      int i3=0x21;//  十六进制0x   0-9 A-F
        System.out.println(i);
        System.out.println(i2);
        System.out.println(i3);
        System.out.println("===================");
        // 浮点数 银行业务怎么表示?
        // fLoat   doubLe  浮点数会四舍五入   会接近但不等于结果
        //  最好完全避免使用浮点数比较
        float f=0.1F;
        double d=1.0/10;
        System.out.println(f==d);
        System.out.println(f);
        System.out.println(d);
        System.out.println("=============");
        char a='a';
        char a2 ='中';
        System.out.println(a);
        System.out.println((int)a);// 表示强制转换
        System.out.println(a2);
        System.out.println((int)a2);
        //转义字符
        // \t 代表空格
        // \n代表换行
        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);
        // b布尔值
        boolean flag=true;
        if (false==true){

        }

    }
}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!