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

 

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

PHP Star Triangle pattern program

PHP Star Triangle pattern program In this tutorial, we will discuss about PHP Star Triangle…

1 month ago

PHP Full Pyramid pattern program

PHP Full Pyramid pattern program In this tutorial, we will discuss about PHP Full Pyramid…

2 months ago

5 methods to add two numbers in Java

5 methods to add two numbers in Java In this tutorial, we will discuss the…

2 months ago

Python Full Pyramid star pattern program

Python full Pyramid star pattern program In this tutorial, we will discuss  the concept of…

5 months ago

Write a function or method to convert C into F -Entered by user

Write a function or method to convert C into F -Entered by the user In…

10 months ago

How to write a function or method to convert Celsius into Fahrenheit

How to write a function or method to convert Celsius into Fahrenheit In this tutorial,…

10 months ago