Naming Convention in Java
Naming conventions make programs more understandable by making them easier to read.
They can also give information about the function of the identifier-for example, whether it's a constant, package, or class-which can be helpful in understanding the code.
Java naming convention is a rule to follow as you decide what to name your identifiers such as class, package, variable, constant, method etc.
It is optional, but it is good practice to follow the naming convention .
IDENTIFIER | RULES FOR NAME |
---|---|
Packages | should be in lowercase letter e.g. java, lang, sql, util etc. |
Classes | Class names should start with uppercase letter and be nouns, e.g. String, Color, Button, System, Thread etc.. |
Interfaces | Interface names should be capitalized like class names. |
Methods | should start with lowercase letter and be a verb e.g. actionPerformed(), main(), print(), println() etc. |
Variables | should start with lowercase letter e.g. firstName, orderNumber etc. |
Constants | should be in uppercase letter. e.g. RED, YELLOW, MAX_PRIORITY etc. |
Java follows camel-case syntax for naming the class, interface, method and variable.
If name is combined with two words, second word will start with uppercase letter always e.g. StringBuffer, actionPerformed(), firstName, ActionEvent, ActionListener etc.
Next topic is java-packages
Training For College Campus
We offers college campus training for all streams like CS, IT, ECE, Mechanical, Civil etc. on different technologies
like
C, C++, Data Structure, Core Java, Advance Java, Struts Framework, Hibernate, Python, Android, Big-Data, Ebedded & Robotics etc.
Please mail your requirement at info@prowessapps.in
Projects For Students
Students can contact us for their projects on different technologies Core Java, Advance Java, Android etc.
Students can mail requirement at info@prowessapps.in