In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "what naming conventions should be followed by java for international project development". In daily operation, it is believed that many people have doubts about the naming conventions that java needs to follow in international project development. The editor consulted all kinds of materials and sorted out simple and useful operation methods. I hope it will be helpful for you to answer the question of "what naming conventions should be followed by java for international project development"! Next, please follow the editor to study!
I. package naming convention
The package name of the software project should be the reverse order of your company's domain name, plus the name of your project, all in lowercase letters and cannot contain other symbols. You can add a version of the package at the end, as shown in the following example:
Org.example.aprojectnameorg.example.aprojectname.innerpkgorg.example.aprojectname.innerpkg.anotherpkgorg.example.aprojectname.innerpkg2org.example.anotherprojectorg.example.anotherproject.v2 II. Class naming convention
The class name must be a noun, use the hump naming method, and the first letter should be capitalized, such as HashMap. You should be able to infer what kind of functions and variables it will contain from the class name. For example:
Class Student {} class ArrayList {} class HashMap {} class ComputerEngineer {} III. Interface interface
Interface names should use adjectives as much as possible. Sometimes it can also be a noun, such as List or Map. As with the naming convention of the class, use the hump naming, the first letter should be capitalized. As follows:
Interface Cloneable {} interface AutoCloseable {} interface PreparedStatement {} interface Engineer {}
Interfaces usually represent the general name of a class of objects. The adjective "will run" can be an interface name, and the implementation class can be human, dog, or cat.
And the use of nouns need to have a certain generality, "claw" is more like the name of an interface than "cat claw".
IV. Variables
Variables should be short and meaningful nouns as far as possible, following hump naming with lowercase initials. And do not use the underscore ('_') or the dollar sign'$'character.
The count variables used in for loops, which can be iDem, j, and n, are also commonly used in integers
For Boolean values, it usually starts with is or has.
You can concatenate multiple nouns using Of
You can use adjectives to modify nouns
Int countOfCustomer; / / Of concatenated float averageInterest; / / adjectives modify nouns long timeInMillisecond, daysInYear; / / time boolean isEngineer, isCompleted, hasSubmitted; / / Boolean type 5, constant
Constants are also an important part of the program. Nouns should also be used, or nouns modified by adjectives. All letters are capitalized and words are separated by underscores.
Public static final float PI = 3.14 position static int CREATED_ON_YEAR = 2019; VI. Method
The method name should use a verb, and the function of the method should be inferred from the name, as short as possible. Use the hump logo to name it. Typically, get and set are used to get data and set up data, respectively. For Boolean values, the method name should be the same as the variable name.
Void print (Object obj); void remove (Obejct obj); Object update (); int getCountOfCustomer (); / / gettervoid setCountOfCustomer (int countOfCustomers); / / setterboolean isUserAdmin (User user); / / Boolean type VII, generic
Using a single capital letter, T is widely used. E is usually used for collection elements, and K and V are usually used for mapping relationships. Do not use multiple characters.
Public void print (T t); interface List {} class HashMap {}; at this point, the study on "what naming conventions should be followed by java for international project development" is over, hoping to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.