Thursday, 24 September 2015

Naming Conventions in Java



1. Class and Interface: - Each word of the class and interface name should start with capital letter as “String”,”DataInputStream”…e.t.c.

2. Packages: - All are written in small letters as
a)java.io
b) java.awt
c) java.swing

3. Variables and Methods: - First word with small letter.then second word should start with capital letter as bellow:-

Methods:-
a)readLine()
b)getNumberInstance()

Variables:-
            a)age
            b)empName
Note:- Here we are differentiating both with the braces “()” and maintaining the same naming convention for both.

4. Constants: - All Constants are represented in CAPS as PI,MAX…e.t.c.


5. Keywords: - All Keywords are represented in lower case letters as public,void,static….e.t.c.

No comments:

Post a Comment