iis服务器助手广告广告
返回顶部
首页 > 资讯 > 精选 >Java 驼峰命名法详解(必看篇)
  • 635
分享到

Java 驼峰命名法详解(必看篇)

驼峰命名法javaava 2023-05-31 13:05:42 635人浏览 泡泡鱼
摘要

标识符:Java对各种变量、方法和类等要素命名时使用的字符序列称为标识符凡是自己可以起名字的地方都叫标识符定义合法标识符的规则:由26个英文字母大小写,0-9,_或$组成数字不可以开头不可以使用关键字和保留字,但是能包括关键字和保留字Jav

标识符:

Java对各种变量、方法和类等要素命名时使用的字符序列称为标识符

凡是自己可以起名字的地方都叫标识符

定义合法标识符的规则:

由26个英文字母大小写,0-9,_或$组成

数字不可以开头

不可以使用关键字和保留字,但是能包括关键字和保留字

Java中严格区分大小写,长度无限制

标识符不能包括空格

取名尽量做到“见名知意”

关于使用中文,oracle 官网给出的文档是这样描述的:

An identifier is an unlimited-length sequence of Java letters and Java digits, the first of which must be a Java letter.Identifier:IdentifierChars but not a KeyWord or BooleanLiteral or NullLiteralIdentifierChars:JavaLetter {JavaLetterOrDigit}JavaLetter:any Unicode character that is a "Java letter"JavaLetterOrDigit:any Unicode character that is a "Java letter-or-digit"A "Java letter" is a character for which the method Character.isJavaidentifierStart(int) returns true.A "Java letter-or-digit" is a character for which the method Character.isJavaIdentifierPart(int) returns true.The "Java letters" include uppercase and lowercase ASCII Latin letters A-Z (\|u0041-\|u005a), and a-z (\u0061-\|u007a), and, for historical reasons, the ASCII underscore (_, or \|u005f) and dollar sign (\$, or \|u0024). The $ sign should be used only in mechanically generated source code or, rarely, to access pre-existing names on legacy systems.The "Java digits" include the ASCII digits 0-9 (\|u0030-\|u0039).Letters and digits may be drawn from the entire Unicode character set, which supports most writing scripts in use in the world today, including the large sets for Chinese, Japanese, and Korean. This allows programmers to use identifiers in their programs that are written in their native languages.

--结束END--

本文标题: Java 驼峰命名法详解(必看篇)

本文链接: https://www.lsjlt.com/news/226043.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作