Java基础学习:标识符

Java基础学习:标识符

  • 关键字

abstractassertbooleanbreakbyte
case catch char calss const
continue default do double else
enum extends final finally float
for goto if implements import
instanceof int interface long native
new package private protected public
return strictfp short static super
switch synchronized this throw throws
transient try void volatile while

java 所有的组成部分都需要名字:类名,方法名,变量名都是标识符;

 

  • 标识符注意点:

    • 所有的标识符都应该以字母(A-Z或者a-z),美元符($),或者下划线( _ ) 开始;

    • 首字母之后可以是字母,$,_ 或数字的任意字符组成;

    • 不能使用关键字作为变量名或方法名

    • 标识符是大小写敏感的

       

 

  • 举例子:

public class Demo01 {
   public static void main(String[] args) {
       String Ahello="zhangsan";
       String hello="zhangsan";
       String $hello="zhangsan";
       String _hello="zhangsan";

       //String 1hello="zhangsan";
       //String #hello="zhangsan";

       String _1="zhangsan";
       //String _#="zhangsan";

       //String class="zhangsan";

  }
}

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

posted @   gzs1024  阅读(21)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
点击右上角即可分享
微信分享提示