Naming Conversion of Java

Google Advertisements

Prev Tutorial Next Tutorial

Naming Conversion of Java

Sun micro system was given following conversions by declaring class, variable, method etc. So that it is highly recommended to follow this conversion while writing real time code.

Why Using naming Conversion

Different Java programmers can have different styles and approaches to write program. By using standard Java naming conventions they make their code easier to read for themselves and for other programmers. Readability of Java code is important because it means less time is spent trying to figure out what the code does, and leaving more time to fix or modify it.

1. Every package name should exist a lower case latter.

Example

package student;  // creating package

import java.lang;  // import package

2. First letter of every word of class name or interface name should exists in upper case.

Example

class StudentDetails
 {
  .....
  .....
 }
interface FacultyDetail
 {
  .....
  .....
 }

3. Every constant value should exists in upper case latter. It is containing more than one word than it should be separated with underscore (-).

Example

class  Student
 {
 final   String  COLLEGE_NAME="abcd";
  ....
  .... 
 }

Note: if any variable is preceded by final keyword is known as constant value.

Example

class  Student
 {
 Final String Student_name="abcd";
 }

While declaring variable name, method, object reference the first letter of first word should be exits in lower case but from the second words onward the first letter should exists in upper case.

Example

class  Student
{
String  StudentName="xyz";
void  instantStudentDetails();
{
  ....
  .... 
}
Student  final

CamelCase in java naming conventions

naming conversion of java

Java follows camelcase syntax for naming the class, interface, method and variable.
According to CamelCase if name is combined with two words, second word will start with uppercase letter always. General Example studentName, customerAccount. In term of java programming e.g. actionPerformed(), firstName, ActionEvent, ActionListener etc.


Prev Tutorial Next Tutorial

Google Advertisements

Buy This Ad Space @$50 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 8076671483

Pure VPN Privide Lowest Price VPN Just @ $1.65. Per Month with Non Detected IP Lowest Price Non Detected IP VPN

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

Cloud computing is the on demand availability of computer system resources, especially data storage and computing power, without direct active management by the user. Cloud Computing Tutorial

College Projects Related to Java, AWT, C Projects for College, C++ Projects for College, Android Projects. Download Java C C++ Projects

Download Projects

Adsense Advertisements


Buy This ads Space 8076671483

Buy This Ad Space @$120 per Month, Ad Size 300X600 Contact on: hitesh.xc@gmail.com or 8076671483 Try this Keyword C++ Programs