In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "what are the contents of Java naming specifications". The explanation in this article is simple and clear, easy to learn and understand. Please follow the ideas of Xiaobian and go deep into it slowly to study and learn "what are the contents of Java naming specifications" together!
Java naming conventions:
1. The project name is all lowercase;
2. All package names are lowercase;
3. The first letter of the class name is capitalized. If the class name consists of multiple letters, each first letter needs to be capitalized.
public class MyFirstClass{}
4. Variable names and method names are lowercase. If they are composed of multiple words, each initial letter after them needs to be capitalized.
int index=0;
public void toString(){}
5. Constant names are all capitalized;
public static final String GAME_COLOR="RED";
6. All naming rules must follow the following principles:
(1)Names can only consist of letters, numbers, underscores and $symbols;
(2)cannot begin with a number;
(3)The name must not use keywords in Java;
(4)Chinese or pinyin naming is resolutely not allowed;
Java annotation specification:
1. Class comments
Class comments must be added before each class. The comment template is as follows:
/** * Copyright ©, 2006-2010, ChengDu Lovo info. Co., Ltd.* FileName: Test.java * Detailed description of class ** @author class creator name * @Date created * @version 1.00*/
2. Attribute comments
Preface each attribute with an attribute comment. The comment template is as follows:
/** */private String strMsg = null;
3. Method Notes
Each method must be preceded by a method comment.
/** * Class method detailed instructions ** @param Parameter 1 Parameter 1 instructions * @return Result instructions * @throws Exception type. Error code indicates the description of throwing exceptions from such methods */Thank you for reading, the above is the content of "Java naming specification", after learning this article, I believe that we have a deeper understanding of the content of Java naming specification, the specific use of the situation also needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.