0% found this document useful (0 votes)
248 views

Java Coding Standards

Java coding standards specify conventions for naming classes, interfaces, methods, variables, and constants. Classes should be nouns with initial caps for each word. Interfaces should be adjectives with initial caps. Method names should be verbs or verb-noun combinations with initial lowercase and caps for each subsequent word. Variables should be nouns with initial lowercase and caps for each subsequent word. Constants should be all caps with underscores between words. Getter methods should be public with no arguments and return the property type. Setter methods should be public, return void, and take the property as a parameter.

Uploaded by

RajashreeRaj
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
248 views

Java Coding Standards

Java coding standards specify conventions for naming classes, interfaces, methods, variables, and constants. Classes should be nouns with initial caps for each word. Interfaces should be adjectives with initial caps. Method names should be verbs or verb-noun combinations with initial lowercase and caps for each subsequent word. Variables should be nouns with initial lowercase and caps for each subsequent word. Constants should be all caps with underscores between words. Getter methods should be public with no arguments and return the property type. Setter methods should be public, return void, and take the property as a parameter.

Uploaded by

RajashreeRaj
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Java coding Standards

1. Coding standards for classes: Usually class name should be noun. Should starts
with upper case letter and if it contain multiple words every inner words also should start
with capital letters.
Example:
String
StringBuffer
NumberFormat
CustomerInformation.
2. Coding standards for Interfaces: Usually interface named should be adjective,
starts with capital letters and if it contains multiple words, every inner word also should
starts with capital letter.
Example:
Runnable
Serializable
Clonable
Movable
Transferable
Workable
3. Coding standards with methods: Values should be either verbs or verb + noun
combination.
Starts with lower case and every inner words starts with upper case(this convention is
also called
camel case convention).
Example: getName(), getMessage(), toString(), show(), display().
4. Coding standards for variables: Usually the variable starts with noun and every
inner word should start with upper case i.e camel case convention.
Example:Name, rollno, bandwidth, totalNumber.
5. Coding standards for constants: It should be noun, it should contain only upper
case letters and works are separated with underscores.
Example:MAX_SIZE, MIN_PRIORITY, COLLEGE_NAME.
6. Syntax for getterMethod: Compulsory it should be public & should not contain any
arguments.
For the non boolean property xxx the following is syntax of getter method
public datatype getXxx()
{
return xxx;
}
7. Syntax of setter Method: It should be public and return type should be void. For
any propertyxxx
public void setXxx(datatype xxx)
{
This.xxx = xxx;
}

You might also like