Java Coding Standard

Java Coding Standard

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.  Ex:   String   StringBuffer   NumberFormat CustomerInformation
 

 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.  Ex:   Runnable   Serializable   Clonable   Movable   Transferable   Workable 
 

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). Ex:   getName(), getMessage(), toString(), show(), display(). 
 

Coding standards for variables 


Usually the variable starts with noun and every inner word should start with upper case i.e camel case convention.  Ex:   Name, rollno,  bandwidth, totalNumber. 
 

Coding standards for constants 


It should be noun, it should contain only upper case letters and works are separated with underscores.  Ex:   MAX_SIZE, MIN_PRIORITY, COLLEGE_NAME. 


Share this

Related Posts

Previous
Next Post »

Recent