Java Naming Convention is a rule to follow as you decide what to name your identifiers such as class, package, variables, constants, methods ext. But, it is not forced to follow, it is known as conventions not rule.
By using standard java naming conventions you make your code easier to read for yourself and for other programmers. Readability of java program is very important. It indicates that less time is spent to figure out what the code does.
The following are the some of the Java Naming Conventions.
The class name should start with uppercase letter and be a noun.
The interface should start with uppercase letter and be an adjective.
Method names should start with lowercase letter and be verb.
Variable name should start with lowercase letter.
Package name should be in lowercase letter.
Constant name should be in uppercase letter.
Java follows camelcase syntax for naming the class, interface, method and variables. If name is combined with two words, second word will start with uppercase letter always.
Example: firstName, helloWorld
Advantages of naming conventions in java
By using standard java naming conventions you make your code easier to read for yourself and for other programmers. Readability of java program is very important. It indicates that less time is spent to figure out what the code does.
The following are the some of the Java Naming Conventions.
The class name should start with uppercase letter and be a noun.
The interface should start with uppercase letter and be an adjective.
Method names should start with lowercase letter and be verb.
Variable name should start with lowercase letter.
Package name should be in lowercase letter.
Constant name should be in uppercase letter.
Java follows camelcase syntax for naming the class, interface, method and variables. If name is combined with two words, second word will start with uppercase letter always.
Example: firstName, helloWorld
0 comments :
Post a Comment
Note: only a member of this blog may post a comment.