Basic

Naming Conventions in Java programming language

Naming Conventions in Java programming language

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

  1. Class name

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

  • Programmer make code easier to read for them self for other developers
  • Readability and understandably is very easy
  • Easy to  find What the program does

 

Suggested for you

Class and main method in Java language

Data type in Java language

Operators in C++

Operators in C

Operators in Python

Keywords in Java language

Data types in Python

Data type in C language

Data type in C++ language

Hollow world program in Java

Data type and variable in Java

History of Java

Download and  install  Java

How to install Java

Feature of Java programming language

Flavour and versions of Java Programming language

 

 

How to download and install Java language
Keywords in Java programming language
Karmehavannan

I am Mr S.Karmehavannan. Founder and CEO of this website. This website specially designed for the programming learners and very especially programming beginners, this website will gradually lead the learners to develop their programming skill.

Recent Posts

How to find reverse number using method in Java

How to find reverse number using method In this article, we will discuss the concept…

1 hour ago

C# inverted full pyramid star pattern

C# inverted full pyramid star pattern In this article, we will discuss the concept of…

3 weeks ago

C# Full Pyramid star pattern program

C# Full Pyramid star pattern program In this article, we will discuss the concept of…

1 month ago

Program to count vowels,consonants,words, characters and space in Java

Program to count vowels, consonants, words, characters and space in Java In this article, we…

1 month ago

How to print multiplication table using Array in C++ language

How to print multiplication table using Array in C++ language In this post, we will…

1 month ago

C Program to multiplication table using Array

C Program to multiplication table using Array In this tutorial , we will discuss about…

2 months ago