Thursday, 11 June 2015

Java Identifiers

Identifiers are programmer-Designed tokens. They are used for naming classes, methods, variables, objects, labels, packages and Interfaces in a program. Java Identifiers follow the following rules:


  1. They can have alphabets, digits, and the underscore and dollar sing character.
  2. They must not begin with a digit.
  3. Uppercase and lowercase letters are distinct.
  4. They can be of any length.


                  Identifiers must be meaningful, short enough to be quickly typed and long to be descriptive and easily read. Java developers have followed some naming conventions.


1. Names of all public methods and instance variables start with a leading lowercase letter.

       Example: average(), sum();

2. When more than one words are used in a name, the second and subsequent words are marked with a leading uppercase letters.

        Example: dayTemperature

3. All primitive and local variables use only lowercase letters combined with underscores.

       Example: length, batch_strength

4. All classes and interfaces start with a leading uppercase letter and each subsequent word with a leading uppercase letter.

    Example: Student, HelloJava

5. Variables that represent constant values use all uppercase letters and underscores between words.

        Example: TOTAL, F_MAX


Along with these java uses the some more naming convention rule. Click Here to know


  

0 comments:

Post a Comment

Advertisement

Find Us On Facebook

C Programming

More

C++ Tutorial

More

Java Tutorial

More

Computer Basics

More

MS Office

More

Database Management

More
Top