java 到camelCase 或不到camel_case
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2082729/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
To camelCase or not to camel_case
提问by Aly
What is the standard when coding in Java, when do you use camel case when do you use underscores etc.
用 Java 编码时的标准是什么,何时使用驼峰式大小写,何时使用下划线等。
回答by Anon.
You stick with the Java Code Conventions.
您坚持使用Java 代码约定。
What exactly the standard is doesn't matter - what matters is that everyone follows it, and you should too.
标准究竟是什么并不重要——重要的是每个人都遵循它,你也应该这样做。
回答by whiskeysierra
ClassName
班级名称
- Renderer
- HttpSession
- 渲染器
- 会话
methodName
方法名
- applyTo()
- run()
- 适用于()
- 跑()
instanceVariable/ localVariable
实例变量/本地变量
- currentUser
- threadList
- 当前用户
- 线程列表
CONSTANT_NAME
CONSTANT_NAME
- LOG
- DEFAULT_CONTEXT
- 日志
- DEFAULT_CONTEXT
G(Generic Type Parameter)
G(通用类型参数)
- T
- E
- 吨
- 乙
回答by Christoph
See Sun's Code Conventions for the Java(TM) Programming Language.
请参阅 Sun 的Java(TM) 编程语言代码约定。

