---
title: "What is the role of naming convention rule in java?"  
description: "What is the role of naming convention rule in java?"  
author: "Nitin Kushwaha"  
published: 2019-07-21  
updated: 2019-07-22  
canonical: https://www.mindstick.com/forum/85211/what-is-the-role-of-naming-convention-rule-in-java  
category: "java"  
tags: ["java", "programming language"]  
reading_time: 2 minutes  

---

# What is the role of naming convention rule in java?

Hii

[Please describe](https://www.mindstick.com/interview/33713/please-describe-the-relationship-between-seo-and-sem)............

## Replies

### Reply by Rahul Roi

**Java Naming Convention Rule:-** \

- It is a rule that is used to identify our identifiers in a code such as class, package, variable, constant, method, etc.
- If we don’t follow naming convention rules, it may generate confusion in the code.

## Advantages of naming convention rules:-

- The code can be read easily.
- The name should not start with a special character such as $, %, @.
- Easy to understand the code.
- If we know about the naming convention rule, we can easily write or implement the things in code.

## Types:-

**CamelCase** (camelCase): If the name contains multiple words, the first letter of the word always in small letter and after that each word with a capital letter.

Example: lastName, mostTalented, etc.

**PascalCase**: If the name contains multiple words, the first letter of every word is in capital letter.

Example: ActionListner, AudioWriter, etc.

## Method:-

- Always use camelcase for the method name.
- Such as println(), main(), etc.

## Syntax:-

```
Class Student
{
Void M1()
{
Code
}
}
```

## Class:-

- Always use PascalCase.
- Such as Employee, Student, etc.

## Syntax:-

```
class Student
{
code
}
```

## Variable:-

- Always use camelcase.
- Such as id, temp, etc.

## Syntax:-

```
class Student
{
int id;
code
}
```

## Package:-

- Always use camelcase.
- Such as java, lang, etc.
- If the name contains multiple words, they are separated by dots (.) like java.lang.package.

## Syntax:-

```
package java.lang.package;
class Student
{
code
}
```

\

\

\

\

\

\

\

\

\


---

Original Source: https://www.mindstick.com/forum/85211/what-is-the-role-of-naming-convention-rule-in-java

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
