Sat. Apr 20th, 2024

Every predefined class, interface, method etc. will follow the java coding conventions and we are recommended to follow the same conventions. It is always a good programing practice to develop a program by following the coding conventions.

1) Conventions for class

A class name can contain any number of words and the first letter of every word should be specified in uppercase.

Example: System ,StringBuffer ,SecondProgram

2) Convention for Interface:

An interface name can contain any number of words and the first letter of every word should be specified in uppercase.

Example: Runnable, ActionListener, MyInterface

3) Convention for a method

A variable name can contain any number of words and the first word should be specified completely in lowercase. The first letter if the remaining words if available should be specified in uppercase.

Example: main() , toCharArray() ,areaOfSquare()

4) Convention for a varibale

A variable name can contain any number of words and the first word should be specified completely in lowercase. The first letter if the remaining words if available should be specified in uppercase.

Example: length , namberOfStudents ,accountNumber

5) Convention for constant:

A constant can contain any number of words. All the letters of all the words should be specified in uppercase, if multiple words are available then separate them ny underscore(_)

Example: MIN_VALUE, MAX_VALUE, PI

6) Convention for a package

A package name should be specified completely in lowercase.

Example: java.lang, java.net, com.androindain

By Rajashekar

I’m (Rajashekar) a core Android developer with complimenting skills as a web developer from India. I cherish taking up complex problems and turning them into beautiful interfaces. My love for decrypting the logic and structure of coding keeps me pushing towards writing elegant and proficient code, whether it is Android, PHP, Flutter or any other platforms. You would find me involved in cuisines, reading, travelling during my leisure hours.

Leave a Reply

Your email address will not be published. Required fields are marked *