In this tutorial, we will discuss about Naming Conventions in Java programming language
Naming Convention in Java language, which is a rule to follow as you decide what to name your identifiers such as class, package, variable, constant, methods etc..
All the classes, interfaces, packages, methods, and fields of Java coding are given according to the Java naming convention
Class names should be nouns always begins with an uppercase letter. And if there are multiple words in the class name, then each word must begin with a capital letter.
class My_Vehicle{ } class Bus{ }
2.Interface name
Interface name must start with the Capitalized letter just like class names and be an adjective.
interface Runnable{ }
3.Method name
Method name should be A verb and must start with a lower camel case convention to look like Object and variables. The first letter is a lower case and if there are multiple words the first letter of each internal word is capitalized.
void get_Method(){ } void set_Method(){ }
4.variable name
Variable name should not start with number or underscore(‘_’) or $ sign
In the Java naming conversions, the variable name must start with a lower case letter and if there are multiple words in the name, use mixed case
String myName; int orderNumber; double totalSalary;
4.Object name
In the java naming conversions, object name must start with the lowercase letter and if there are multiple words in the name use lower camel case.(you need to use Upper case for starting letters for the word except for the starting words)
My_Class obj=new My_class(); Scanner sc = new Scanner(System.in);
5.package name
the package name must start with lower case letter. And when there are multiple words in the package name, then you need to use upper case for all words except for the starting words
java, lang, sql, util etc
6.constants name
constants name must start with the uppercase letter. there are multiple words must be separate ‘_’
static final String FIRST_NAME="Kannan"
Advantages in Naming Convention in Java language
Suggested for you
Class and main method in Java language
Data type and variable in Java
Feature of Java programming language
Flavour and versions of Java Programming language
How to find reverse number using method In this article, we will discuss the concept…
C# inverted full pyramid star pattern In this article, we will discuss the concept of…
C# Full Pyramid star pattern program In this article, we will discuss the concept of…
Program to count vowels, consonants, words, characters and space in Java In this article, we…
How to print multiplication table using Array in C++ language In this post, we will…
C Program to multiplication table using Array In this tutorial , we will discuss about…