欢迎访问悦橙教程(wld5.com),关注java教程。悦橙教程  java问答|  每日更新
页面导航 : > > 文章正文

Java标识符 关键字,java标识符

来源: javaer 分享于  点击 39373 次 点评:4

Java标识符 关键字,java标识符


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

命名规则:


 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,然后将取道的余数倒过来
二进制转换十进制

相关文章

    暂无相关文章
相关栏目:

用户点评