java naming conventions

Methods should be verbs, in mixed case with the first letter lowercase, 
with the first letter of each internal word capitalized.
Example:
run();
runFast();
getBackground();

3.8
5

                                    
// Class //
It should start with the uppercase letter.
It should be a noun such as Color, Button, System, Thread, etc.
Use appropriate words, instead of acronyms.
Example:
public class Employee  
{  
//code snippet  
}  

// Interface //
It should start with the uppercase letter.
It should be an adjective such as Runnable, Remote, ActionListener.
Use appropriate words, instead of acronyms.
Example:
interface Printable  
{  
//code snippet  
}  

// Method //
It should start with lowercase letter.
It should be a verb such as main(), print(), println().
If the name contains multiple words, start it with a lowercase letter followed by an uppercase letter such as actionPerformed().
Example:
 class Employee  
{  
//method  
	void draw()  
	{  
//code snippet  
	}  
} 

// Variable //
It should start with a lowercase letter such as id, name.
It should not start with the special characters like & (ampersand), $ (dollar), _ (underscore).
If the name contains multiple words, start it with the lowercase letter followed by an uppercase letter such as firstName, lastName.
Avoid using one-character variables such as x, y, z.
Example :-
  class Employee  
{  
//variable  
	int id;  
//code snippet  
}

// Package //
It should be a lowercase letter such as java, lang.
If the name contains multiple words, it should be separated by dots (.) such as java.util, java.lang.
Example:
package com.javatpoint; //package  
class Employee  
{  
//code snippet  
}

// Constant //
It should be in uppercase letters such as RED, YELLOW.
If the name contains multiple words, it should be separated by an underscore(_) such as MAX_PRIORITY.
It may contain digits but not as the first letter.
Example:
class Employee  
{  
//constant  
 	static final int MIN_AGE = 18;  
//code snippet  
}

3.8 (5 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
appropriate Java naming conventions? java project name naming convention naming convention main java java naming conventions reference most common java naming conventions what is java naming convention java naming conventions for methods and instances java conventions naming naming convention java variable naming convention java naming convention rules in java java method name convention java language convention java method naming conventions class naming convention in java check for naming convention in java java naming conventions for classes Class Naming convention java java language conventions java method naming with and java class naming conventions project naming convention in java types of naming conventions in java What is the naming convention followed for methods in java? Given an example Discuss the java naming conventions java Use the naming rules and conventions java naming rules and conventions java generics naming convention naming ways in java java object naming conventions java style conventions generic naming conventions java appropriate java naming conventions method name in java convention java function naming convention naming method in java java vo naming conventions naming conventions java method name conventions java java naming conventions best practices naming convention java Variable Names Conventions in java java generic Naming Conventions variable naming convention in java naming conventions methods java naming conventions method java java variable naming conventions method naming convention in java java generic naming convention Java naming convention examples naming conventions in ajva what is variable naming convention called in java Java convention Naming a Method java methode name conventions what is naming convention in java method naming convention java java naming conventions class java set naming convention naming convention for java class java Naming convention for classes Naming java how to give naming conventions in java java swing naming conventions java method naming convention java name convention variable naming conventions java Naming conventions in Java name convention java java class naming convention programming naming convention java method name convention in java java conventions java naming convention naming convention in java java naming conventions
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source