🪔 शुभ नवरात्रि!    Use Code: FESTIVALOFF300    Invoke the power of knowledge – Get ₹300 to ₹800 OFF on Java Courses 🎊
Celebrate & Learn 🙏

Keywords in Java  


Introduction

  • Keywords are the predefined, reserved words used by the Java compiler for specific operations.
  • There are total 50 keywords in Java, in which 48 keywords are actively used in programming and 2 reserved words (goto and const) that are not currently used in java.

Below is the list of all reserved words in java :-

Category Keywords
Data Types boolean, char, byte, short, int, long, float, double
Control Statements if, else, switch, case, default, for, while, do, break, continue
Class/Interface class, interface, enum, extends, implements
Object Management new, this, super, null
Modifiers abstract, final, static, synchronized, transient, volatile
Package Management package, import
Access Modifiers public, private, protected
Return Type void, return
Exception Handling try, catch, finally, throw, throws, assert
Synchronization synchronized
Others native, strictfp, boolean, instanceof
Not Used goto, const

Characteristics of Keywords in Java:
  • Reserved Words: Keywords are reserved words having specific meanings for particular functions in the Java language.
  • Case-Sensitive: All keywords in Java are case-sensitive (e.g., class is a keyword, but Class is not).
  • Cannot be Identifiers: They cannot be used to name variables, methods, classes or other user-defined identifiers.
  • Enhance Readability: Keywords make the code easier to understand by providing a common vocabulary for developers.
  • Fixed Set: Java has a fixed list of keywords, and new ones are rarely added across versions.