- Keywords are predefined identifiers available directly throughout the JVM.
- They have a special meaning inside java source code and outside of comments and strings.
- For Example : public, static, void
- Keywords can not be used as user defined identifier by the programmer either for variable or method or class names, because keywords are reserved for their intended use.
- All characters in keyword must be used in lower case.
Need of keywords:
- Basically keywords are used to communicate with compiler and JVM about the operation we perform in java application.
- In java we perform 10 different operations using keywords
- They are:
- Creating Java file
- Storing data temporary
- Creating memory locations
- Controlling calculations
- Setting accessibility permissions
- Modifying default properties
- Object representation
- Establishing relations between classes
- Grouping classes
- Handling user mistakes
- In java we have 50 keywords to perform all above 10 operations
- Among them 47 introduced in java 1.0
- In Java 1.2 new keyword "strictfp" was added.
- In Java 1.4 new keyword "assert" was added
- In Java 5 new keyword "enum" was added
- Among 50 keywords 2 keywords are reserved words they can not be used in java program, because they defined but they are not implemented , those two are,