Java 基础 之 标识符

http://www.verejava.com/?id=1699254299287java

/*
标识符的命名规则:
1. 是以字母,数字,下滑线_和美圆符号$ 组成
2. 不能以数字开头
3. 区分大小写
4. 不能是java的保留关键字
5. 最好是见名思意
*/
public class Identifier
{
    public static void main(String[] args)
    {
        //不能以数字开头
        //int 1number=1;

        //标识符区分大小写
        int b=2;
        int B=3;
        System.out.println(b);
        System.out.println(B);
        //不能是java 的保留关键字
        //int class=4;
        
        //年龄最好见名思意
        int age=30;
        //两个字符串相链接用加号 +
        System.out.println("年龄是:"+age);

    }
}

http://www.verejava.com/?id=1699254299287code

>>>>阅读全文字符串

相关文章
相关标签/搜索