Java Keywords:
It is very important to know about the Java keywords before you go to develop Java program. These keywords are part and parcel of Java program. In this article I will introduce you with some Java keywords. There are almost 50 keywords in java. Some of them are explained below:
Class: It is used to define an implementation of a particular kind of object. A class can have class fields, methods and inner classes.
Import: This keyword is used at the beginning of a source file( before class ) to import classes or even entire java packages.
Public: It is used to declare methods and fields public.
Static: It is used to declare a field, method or inner class as a class field.
Void: It is used to declare a method that does not return any value.
Double: It is used to declare a double field. A double is primitive data type that is capable of storing decimal number.
Int: Int is a primitive data type that is capable of storing a 32-bit whole number.
If: It is used to create an if statement. The if statement test a boolean expression.
Case: This keyword is used to create individual individual cases in a switch statement.
Switch: The switch keyword is used in conjunction with the case and default keywords. It evaluates a variable and matches it to a specific case.
Else: It is used in conjunction with the if keyword to create an if-else statement.
While: It is used to create a while and do-while loop, which tests a boolean expression and keeps running the same block of code until the boolean expression returns false.
Private: It is used to declare methods and fields private.
Boolean: A boolean is a primitive data type that can store only two values: true or false.
Break: Break is used to immediately breakout of the loop or switch statement it is inside of.
Abstract: It is used to declare a class or method abstract.
Assert: This keyword was added in J2SE 1.4 and is used primarily in the debugging phase of programming.
Byte: This keyword is a primitive data type that is capable of storing 8-bit whole number.
Float: It is a primitive data type that is capable of storing a 32-bit floating point number ie, decimal number.
For: It is used to create a for loop. There are three parts of a for loop- initialization, boolean expression and incrementation.
It is very important to know about the Java keywords before you go to develop Java program. These keywords are part and parcel of Java program. In this article I will introduce you with some Java keywords. There are almost 50 keywords in java. Some of them are explained below:
Class: It is used to define an implementation of a particular kind of object. A class can have class fields, methods and inner classes.
Import: This keyword is used at the beginning of a source file( before class ) to import classes or even entire java packages.
Public: It is used to declare methods and fields public.
Static: It is used to declare a field, method or inner class as a class field.
Void: It is used to declare a method that does not return any value.
Double: It is used to declare a double field. A double is primitive data type that is capable of storing decimal number.
Int: Int is a primitive data type that is capable of storing a 32-bit whole number.
If: It is used to create an if statement. The if statement test a boolean expression.
Case: This keyword is used to create individual individual cases in a switch statement.
Switch: The switch keyword is used in conjunction with the case and default keywords. It evaluates a variable and matches it to a specific case.
Else: It is used in conjunction with the if keyword to create an if-else statement.
While: It is used to create a while and do-while loop, which tests a boolean expression and keeps running the same block of code until the boolean expression returns false.
Private: It is used to declare methods and fields private.
Boolean: A boolean is a primitive data type that can store only two values: true or false.
Break: Break is used to immediately breakout of the loop or switch statement it is inside of.
Abstract: It is used to declare a class or method abstract.
Assert: This keyword was added in J2SE 1.4 and is used primarily in the debugging phase of programming.
Byte: This keyword is a primitive data type that is capable of storing 8-bit whole number.
Float: It is a primitive data type that is capable of storing a 32-bit floating point number ie, decimal number.
For: It is used to create a for loop. There are three parts of a for loop- initialization, boolean expression and incrementation.