一、Identifiers: 标识符 Names of class,method and variable 用于类名、方法名、变量名 Begin with character,_ or $ 标识符不能以数字开头 Case sensitive ...
一、Identifiers: 标识符
Names of class,method and variable 用于类名、方法名、变量名
Begin with character,'_' or '$' 标识符不能以数字开头
Case sensitive 大小写敏感
No length limitation 长度不受限制
标识符不能是java关键字,汉字也可以做标识符,当时不建议使用(涉及编码和跨平台问题)
String 是java的一个类,类名是可以作为标识符的。
Java中sizeof不是运算符,可以作为标识符。
关键字、保留字(const,goto,true,false,null)不能作为标识符。
public class Identifiers { public static void main(String[] args) { String $abc = "abc1"; String _abc = "abc2"; // 编译错误,标识符不能以数字开头 // String 8abc="abc3"; String 中国 = "China"; String String = "jaya"; int Integer = 22; // Java中没有sizeof运算符,所以sizeof可以作为标识符 String sizeof = "sizeof"; System.out.println(String);// jaya System.out.println(Integer);// 22 }}
海外公司注册、海外银行开户、跨境平台代入驻、VAT、EPR等知识和在线办理:https://www.xlkjsw.com
原标题:Java 基础知识总结 (一、标识符)
关键词:JAVA
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。