微君

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
统计
 

进制

int i = 10;
int i2 = 010;//8进制,0开头
int i3 = 0x10;//16进制,0x开头
int i4 = 0xF;//15,10-15:A-F
System.out.println(i);//10
System.out.println(i2);//8
System.out.println(i3);//16
System.out.println(i4);//15

浮点

//浮点数拓展。银行业务怎么表示?钱
       //BigDecimal 数学工具类
       //=====================================
       //float   有限   离散   舍入误差   大约 接近但不等于
       //double
       //最好完全避免使用浮点数!!!
       //最好完全避免使用浮点数!!!
       //最好完全避免使用浮点数!!!
       float f = 0.1f;//0.1
       double d = 1.0/10;//0.1
       System.out.println(f == d);//false

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

字符

//字符拓展?
       char c1 = '中';
       char c2 = 'A';
       System.out.println(c1);//中
       System.out.println((int)c1);//20013

       System.out.println(c2);//A
       System.out.println((int)c2);//65
       //所有字符的本质还是数字
       //编码 Unicode Excel 2^16 = 62236
       //U0000 UFFFF
       char c3 = '\u0061';
       System.out.println(c3);//a

       //转义字符
       //\t 制表符(空格)
       //\n换行
       System.out.println("Hello\tWord");//Hello Word
       System.out.println("Hello\nWord");//Hello
                                         // Word
String sa = new String("hello word");
      String sb = new String("hello word");
      System.out.println(sa == sb);//false

      String sc = "hello word";
      String sd = "hello word";
      System.out.println(sc  == sd);//true
       //对象   从内存分析

boolean

boolean flag = true;
       if(flag == true){}
       if(flag){}
       //代码要精简精读,最好用第二个表示方法

 

posted on   微君  阅读(65)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列1:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现
· 25岁的心里话
 
点击右上角即可分享
微信分享提示