Java标识符 关键字

来源:互联网 发布:阿里人工智能概念股 编辑:程序博客网 时间:2024/05/23 01:58

标识符: 主要是给类、变量、方法起名字

命名规则: 1. 首字母必须是下划线、字母、$  2. 其余部分可以是字母、数字、下划线、$  3. Java大小写敏感,且长度无限制,适中就好 4. 见名知意,建议使用英文 5. 不可以使用Java关键字关键字:abstract        boolean      break       byte        case catch     char(character) class   const   continue    defaultdo double    else    extends     final       finally         float       for     goto        if implements import  instanceof  int     interface   long        native  new null        package private protected   public      return      short         static          strictfp    super       switch      synchronizedthis        throw           throws      transient   try         void        volatile    while       <h1>代码示例:<h1/>-----public static oid main(String[] args){//错误的标识符//int 1a = 10;//int #a = 10;int _a = 10;int $a = 10;int a1 = 10;int aa = 10;int age =20;int width = 50;int height = 180;String name = "张三";//标识符虽然汉字可以,但是不要去使用int ¥a =10;int 你好=10;}}

标识符的类型:
Java是一种强类型的语言,标识符在定义的时候必须声明它的类型

十进制转换二进制        让数字对2取余(0/1)    然后商对2继续取余,一直取道1,然后将取道的余数倒过来二进制转换十进制
0 0
原创粉丝点击