基本词汇day1

2021/7/11 6:09:55

本文主要是介绍基本词汇day1,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

基本词汇

注释词汇

Annotations 注解

Comments 注释

  • Block comment 块

  • Line comment 行

JavaDos 文档注释 /** */

/** 
 *@description  (描述)
 *@Author   (作者)
 */

关键字

数据类型

  • primitive type 基本数据类型

    • 整数类型:byte、short、int、long(long num = 30L;)

    • 浮点类型:float(float num = 30.1F;)、double

    • 布尔类型:boolean

    • 字符类型:char

  • reference type 引用数据类型

    • 接口

    • 数组

数据类型扩展

整数扩展

  • 进制:二进制0b 八进制0 十六进制0x

    int i = 10;//十进制
    int i1 = 0b10;//二进制
    int i2 = 010;//八进制
    int i3 = 0x10;//十六进制

浮点数扩展

  • 银行业务怎么表示?

    • float 有限 离散 舍入误差 大约 接近但不等于

    • double

    • BigDecimal 数学工具类

    float d = 0.1f; //0.1
    double s = 1.0/10;  //0.1
    System.out.print(d==s); //false
    ​
    ​
    float num1 = 1213213123130f;
    double num2 = num1 + 1;
    System.out.print(d==s); //true

字符扩展

  • char 所有的字符本质还是数字,通编码(Unicode)表查找转换

    char c = 'a';
    System.out.print((int)c);   //强制转换  c = 97;
  • 转义字符 \t \n

布尔值扩展

  • boolean

    boolean flag = true;
    if(flag){
        System.out.print(flag);
    }


这篇关于基本词汇day1的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程