Hey everyone !!! In this section I am going to explain you about various standards which we are using in Java. Probably we can call all these as the back bone of this language.
In a Java Program we are using classes, interfaces, enums, methods, variables, package, constant and annotations.
Don't worry on the concept that what is class what is package what is method etc....in this article just draw your attention towards the naming convention , later I will elaborate each topic.
Now individually I am going to explain you how we can write class names or package names etc...
CLASS NAMES :-
In java all the class names must start with uppercase letters. If the classname contains multiple words every new word must start with a upper case letter. It is not must that we should start the next word of the class name with a uppercase letter but it is recommended.
Eg :- class String {
// body of class
}
class BankAccount {
// body of class
}
INTERFACE NAMES AND ENUM NAMES :-
It is also very much similar to class names, all the interface names and enum names must start with a upper case letter. If the interface name and enum name contain multiple words then every inner word must start with upper case letter.
Eg: interface Book {
}
enum IndianNavy {
}
METHOD NAMES :-
In Java functions are called as methods, what we study in c as fuctions here in java it is called as methods.
All the method names must start with the lower case letters. If the method name contain multiple words then every inner word must be start with the capital letter
Eg :-
getStudentDetails();
setEmployee();
deleteCustomer();
VARIABLE NAMES :-
In java variable names must start with the lowercase letters and if the variable name contains multiple word then every inner word must start with the upper case letter.
Again I will tell you that it is not necessary that every inner word must start with a upper case letter but it is the standard decided by java corporation so later if anyone else will be reading your code it becomes very easy for that person to understand it quickly.
Eg :- class Student {
int studentId;
char studentName;
}
PACKAGE NAMES :-
Package is like a folder which contains all the classes, here I am just considering its naming rule about the package we will understand it later.
In java all the package names contains only the lower case letters, it the package name contains multiple letter then the inner word will not start with the upper case letter, it will be continued with the lower case letter only.
Eg java.lang
java.swing
java.sql
java.awt
Classes are defined inside the class the package so it can be written as
java.io.BufferedReader
Here io is the package name and the BufferedReader is the class name.
Title :
JAVA :- JAVA CODING STANDARDS
Description : Hey everyone !!! In this section I am going to explain you about various standards which we are using in Java. Probably we can call all the...
Rating :
5