Naming Conversion of Java

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 Advertisment

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

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

For Projects 9999595223

Google Advertisements


Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements