In this section, we will discuss on the Keyword in Java in details.
Objective:
- Identifier
- Reserved Word
- Naming convention of identifier
- What is Keywords in Java
- Use of Keywords in Java
- Reserved Word
Before going into depth of the Keyword, we need to understand the naming convention of variable. As Java is strongly typed language, variable / identifier must be declared before used it.
How you will name the identifier ?
There are some protocol which need to be keep in mind when you are declaring the variable.
- Identifier/ variable should not be start with a number.
- I can contain the character [A-Z], [a-z], numbers [0-9].
- @ should not be used for declaring the identifier.
- Variable names should not contain space in between the name.
- It should not contain the Reserved keyword like float, int etc.
- Identifier/ variable should not contain below character.
- (
- )
- {
- }
- /
- \
- [
- ]
- *
- +
- –
- ,
- ;
- ‘
- #
- %
- !
- ^
- .
- “
- $ and _ can be used to declare the identifier.
Let’s take a quick assessment to check the valid identifier name.
- Myname = Valid
- myname = Valid
- id5 = Valid
- 5id = Invalid
- A = Valid
- ABC = Valid
- My name = Invalid
- My-name = invalid
- A&B = Invalid
- Float = Invalid
Reserved Keyword:
As we checked that variable name should not contain the reserved keyword in java.
What is Reserved Keyword?
From the name you can guess that Reserved keywords are reserved for some functions. So it can not be used to name the variable. If you use the reserved keyword in identifier name then it will throw an error.
Every keyword has its own meaning of functionality. Literals defines the value of the keyword.

Keywords in Java:
There are many keyword available in java which has different action defined in java. Let’s discuss some of them below.
- abstract : This is used to declare the class as abstract. Abstract class has only abstract method. It does not contain any body. It is only a signature. Its implementation is declared in child class.
- assert : If you want to verify the value with the specifier value, then you need to use assert keyword. It is introduced in J2SE 1.4 version.
- boolean: Boolean is the primitive data type. This contains only 2 values. i.e TRUE & FALSE.
- break : This is used to break the statement in loop or switch case to achieve certain target.
- byte : Like Boolean this is also a primitive data type. 0 is the default value for the byte data type.
- case : This is used in switch case loop to check certain condition.
- catch : In Exception handling in java, catch is used to handle the exception. If you want to handle some IOException then in catch statement only you need to declare that will be the instruction to be executed.
- char : char is a primitive data type which contain the unicode character in quote.
- class – class is the keyword through which user can create the user defined