Java has a fixed set of reserved words called keywords. These words have special meaning in the language and cannot be used as variable, method, or class names.
Think of them as the “grammar rules” Java uses to understand what you’re trying to do.
Control Flow
These keywords control how code runs:
if
,else
– decision-makingswitch
,case
,default
– multiple condition branchingfor
,while
,do
– loopsbreak
,continue
– exit or skip loop blocksreturn
– exit a method and optionally send a value back
Class & Object Structure
Used to define structure of programs:
class
,interface
,enum
,record
– define typesextends
,implements
,sealed
– inheritancethis
,super
– refer to current/parent object
Access Control
Used to define visibility:
public
,private
,protected
– who can accessstatic
– belongs to class, not instancefinal
– value can’t be changed or method/class can’t be overridden
Modifiers & Utilities
abstract
– incomplete class or methodsynchronized
– used in multithreadingtransient
,volatile
– used in serialization and memory controlnative
– links to non-Java code (e.g., C)
Exception Handling
try
,catch
,finally
,throw
,throws
– manage errors safely
Boolean Logic
true
,false
,null
– constants
Primitive Types
int
,double
,char
,boolean
,byte
,short
,long
,float
Java has 50+ keywords, but you’ll become familiar with them naturally as you write more code. You don’t need to memorize them upfront—just recognize them and avoid using them for names.