CoderSathi
  • Tutorial
    • Java Tutorial
    • Swing Tutorial
    • JDBC Tutorial
    • Java String Tutorial
    • Servlet and JSP Tutorial
  • Mongo DB
  • AWS
  • DevOps
  • Linux
  • Git
Home > Java > Java Keywords and Reserved Words

Java Tutorial

  • Introduction
    • What is Java
    • History Of Java
    • Install Java
    • What is JVM
    • JDK vs JRE vs JVM
    • Java Bytecode
    • OOP vs POP
    • Compile and Run Java
  • Tokens, Expressions and Control Structures
    • Primitive data types
    • Integers
    • Floating Points
    • Characters
    • Booleans
    • User Defined Data Type
    • Declarations
    • Constants
    • Identifiers
    • Literals
    • Type Conversion and Casting
    • Variables
    • Default Variable Initialization
    • Command Line Arguments
    • Arrays of Primitive Types
    • Comment Syntax
    • Garbage Collection
    • Expressions
    • Operators
    • Arithmetic Operator
    • Bitwise and Shift Operator
    • Comparison or Relational Operators
    • Logical Operators
    • Assignment Operators
    • Ternary Operator
    • Increment and Decrement Operator
    • Control Statements
  • OOP Concepts
    • Class and Object
    • Create Class Instance
    • Method
    • Abstraction
    • Encapsulation
    • this keyword
    • Constructor
    • Pass by Value
    • Access Modifier/Control
    • Polymorphism
    • Method Overloading vs Method Overriding
    • Recursion
    • Nested and Inner Class
  • Inheritance and Packaging
    • Inheritance
    • extends Keyword
    • super Keyword
    • Object Class
    • Abstract class
    • Final Class
    • Java Package
    • Interface
  • Handling Error/ Exceptions
    • What is Exception
    • Exception Handling Keywords
    • Common Java Errors
    • User Defined Exception
    • Throwing and re-throwing Exception
    • finally Block
  • Strings
    • Java String Tutorial
  • Threads
    • Introduction
    • Create Thread
    • Thread Lifecycle
    • Thread Priority
    • Thread Synchronization
    • Inner Thread Communication
    • Thread Deadlock
  • IO and Streams
    • java.io Package
    • Files and Directories
    • Byte Stream
    • Character Stream
    • Console Input and Output
    • Serializable and Deserializable
  • Core Packages
    • java.lang Package
    • Math
    • Wrapper Classes
    • java.lang.Number
    • Double
    • Float
    • Integers
    • java.lang.Byte
    • java.lang.Short
    • java.lang.Long
    • java.lang.Character
    • java.lang.Boolean
    • java.util package
    • Vector Class
    • Stack Class
    • Dictionary Class
    • Hashtable
    • Enumeration or Enum
    • Generate Random Number
  • Holding Collection of Data
    • Arrays
    • Map
    • List
    • Set
    • Collection Interface
    • Collections Class
    • ArrayList
    • HashSet
    • TreeSet
    • Comparator
  • Java Bean
    • What is Java Bean
    • Advantages and Disadvantages of Java Bean
    • Java Beans API
    • Introspection
    • Java Bean Properties
    • Bound and Constrained Properties
    • BeanInfo Interface
    • Customizers
    • Java Beans Persistence
    • BeanDescriptor

Java Keywords and Reserved Words

Learn the concepts, implementation details, and practical steps with a clean developer-focused walkthrough.

Yuba Raj Kalathoki
By Yuba Raj Kalathoki
Last updated: July 1, 2026 · 2 min read · 0 Comments
Share: in X

Java Keywords are the words that are used by Java for internal use. Let’s say we declare a variable:

int id = 1234;

Java will allocate 4 bytes of memory to the variable id. This is because int is already recognized by Java and it knows what to do when a developer uses int word and also knows how much memory to allocate for its variable like id. If the word int was not already recognized by Java then it would have done nothing.

Let’s take another example:

for(int a=1; a<=5; a++){
    System.out.println(a);
}

Java knows to execute print statement 5 times because it already knows what to do when the developer defines the word for.

Hence, the keywords are the predefined words in Java that have internal functionality and Java does internal processing based on these keywords.

Following are the list of keywords in Java.

abstractcontinuefornewswitch
assertdefaultgotopackagesynchronized
booleandoifprivatethis
breakdoubleimplementsprotectedthrow
byteelseimportpublicthrows
caseenuminstanceofreturntransient
catchextendsintshorttry
charfinalinterfacestaticvoid
classfinallylongstrictfpvolatile
constfloatnativesuperwhile

The following keywords are not used by Java yet but are reserved and we can’t use them as an identifier in our program.

  • const
  • goto
  • strictfp

There are three literals in Java Keywords and these are:

  • true
  • false
  • null

Frequently Asked Questions

What are keywords in Java?

Keywords in Java are reserved words that have predefined meanings and cannot be used as identifiers (e.g., variable names, class names).

How many keywords are there in Java?

Java has around 56 keywords that are recognized by the Java compiler, each serving a specific purpose in the language. Detail can be read on List of Java Keywords.

Can I use keywords as variable names or identifiers in Java?

No, you cannot use keywords as variable names or identifiers in Java. Attempting to do so will result in a compilation error.

What are reserved words in Java?

Reserved words are keywords that are not currently used by the language but are reserved for potential future use. They should not be used as identifiers to avoid conflicts with future versions of Java.

Why is it important to be aware of Java keywords and reserved words?

Understanding Java keywords and reserved words is crucial for writing error-free and maintainable code, as using them improperly can lead to compilation errors and unexpected behavior.

Reference: Java Language Keywords

Related Posts:

  • Control Statements in Java
  • Identifiers in Java
  • Compile and Run Java Program
  • MySQL Commands for Developers
  • What Is Java Swing? A Complete Guide to Java’s GUI Toolkit
  • Packages in Java: A Guide to Modular, Maintainable Code
Tags:javalanguage-fundamentals
Was this article helpful?
← Previous ArticleLiterals in Java
Next Article →Operators in Java

Recent Posts

  • How to implement Passwordless Authentication in Spring Boot: A Step-by-Step Guide
  • How to Use AWS CloudFront Signed URLs in Spring Boot?
  • How to Fix SSH Agent Forwarding on macOS: The Ultimate Guide for Developers
  • How to Read AWS Secrets Manager in Spring Boot (Step-by-Step)
  • How to Fix “Public Key Retrieval is not allowed” MySQL JDBC Error
CoderSathi

Your go-to resource for Java, Spring Boot, Microservices, AWS, and modern development tutorials.

Linkedin

Quick Links

  • About
  • Contact

Popular Topics

  • Java
  • Spring Boot
  • AWS
  • DevOps
  • MongoDB
  • Linux
  • Git
  • How to
© 2026 CoderSathi. All rights reserved. Privacy Policy · Sitemap