Java中的类名称约定 [英] Class name convention in java

查看:62
本文介绍了Java中的类名称约定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

java中类的命名约定是什么,例如,所有类都应像MYCLASS.java这样大写吗?

What is the naming convention of classes in java, for example should all classes be in upper case like MYCLASS.java ?

com.sun.org.apache.bcel.internal.generic之类的类. ANEWARRAY .也可以在Sun的图书馆中找到

as some classes like com.sun.org.apache.bcel.internal.generic. ANEWARRAY. can be found in Sun's library as well

注意:我已经从 Oracle 阅读了所有命名约定,但是我找不到任何说我们应该使用全大写字母来命名一个类.

Note: I have read all naming convention from Oracle but I could not find anything which says we should name a class with All Uppercase.

推荐答案

浏览了许多链接之后,我发现没有Java约定可以建议我们以所有大写字母命名一个类.但是,这样做不会有任何错误.

After browsing through many links I came to know there is no java convention which suggests us to name a class in all uppercases. However we do so there will not be any error.

CloudyMarble 提到了一个适当的原因,即如果缩写更像HTML之类的话,我们可以使用此约定.

One appropriate reason is mentioned by CloudyMarble that we can use this convention if the abbreviation is more famous like HTML.

我还想添加一些有关ANEWARRAY的信息,该类受Apache许可

Also I would like to add some info about ANEWARRAY, this class comes under Apache license Source and Create new array of references.

这篇关于Java中的类名称约定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆