Java coding convention

Classes:-

  • Class name start with upper case letter and every inner word starts with upper case letter.
  • This convention is also known as camel case convention.
  • The class name should be nouns.

Ex:-      String                 StringBuffer                 InputStreamReader    ……etc

Interfaces :-

  1. Interface name starts with upper case and every inner word starts with upper case letter.
  • This convention is also known as camel case convention.
  • The class name should be nouns.

Ex: Serializable        Cloneable           RandomAccess

Methods :-

  • Method name starts with lower case letter and every inner word starts with upper case letter.
  • This convention is also known as mixed case convention
  • Method name should be verbs.

Ex:- post()           charAt()                toUpperCase()                   compareToIgnoreCase()

Variables:-

  • Variable name starts with lower case letter and every inner word starts with upper case letter.
  • This convention is also known as mixed case convention.

Ex :- out     in    pageContext

Package :-Package name is always must written in lower case letters. Ex :-java.lang java.util java.io …etc

Constants:-

  • While declaring constants all the words are uppercase letters .

Ex: MAX_PRIORITY        MIN_PRIORITY         NORM_PRIORITY

NOTE:- The coding standards are mandatory for predefined library & optional for user defined library but as a java developer it is recommended to fallow the coding standards for user defined library also.

Published by Atul maurya

i am student of computer science & engineering .i want to become a java developer. my hobby is to learn programming language in easy way.

Leave a comment

Design a site like this with WordPress.com
Get started