Keywords
Keywords are special words in Java whose meanings are already defined by the compiler. These words are reserved by the Java language, which means they cannot be used as identifiers (like variable, class, or method names).
That’s why keywords are also called "reserved words" — because they are reserved from user-defined use.
Categories of Reserved Words:
- Used Keywords (65): Actually used in Java programs like class, if, for, int, etc.
- Unused Keywords (2): const and goto are reserved for future use but currently not used in Java.
- Reserved Literals (3): true, false, and null are not technically keywords, but they are also reserved and can’t be used as identifiers.
Reserved words in Java are:
Summary:
- You cannot use any reserved word as a variable name, class name, or method name.
- These words are predefined by the language and have specific purposes.
- Trying to use them as identifiers will result in a compile-time error.