Reserved Words in Java
Any programming language reserves some words to represent functionalities defined by that language. These words are called reserved words. They can be briefly categorized into two parts: keywords(50) and literals(3). Keywords define functionalities and literals define value. Identifiers are used by symbol tables in various analyzing phases(like lexical, syntax, and semantic) of a compiler architecture.
abstract | continue | for | protected | transient |
Assert | Default | Goto | public | Try |
Boolean | Do | If | Static | throws |
break | double | implements | strictfp | Package |
byte | else | import | super | Private |
case | enum | Interface | Short | switch |
Catch | Extends | instanceof | return | void |
Char | Final | Int | synchronized | volatile |
class | finally | long | throw | Date |
const | float | Native | This | while |
Note: The keywords const and goto are reserved, even though they are not currently used. In place of const, the final keyword is used. Some keywords like strictfp are included in later versions of Java.
Java Identifiers
In Java, identifiers are used for identification purposes. Java Identifiers can be a class name, method name, variable name, or label.
Example of Java Identifiers
public class Test
{
public static void main(String[] args)
{
int a = 20;
}
}
In the above Java code, we have 5 identifiers namely :
- Test: class name.
- main: method name.
- String: predefined class name.
- args: variable name.
- a: variable name.
Contact Us