Skip to content
Related Articles

Related Articles

Improve Article

List of all Java Keywords

  • Difficulty Level : Basic
  • Last Updated : 30 Sep, 2021
Geek Week

Keywords or Reserved words are the words in a language that are used for some internal process or represent some predefined actions. These words are therefore not allowed to use as variable names or objects. If we do we will get a compile-time error as shown below as follows:


// Java Program to Illustrate What If We Don't
// have knowledge of Keywords(Reserve Words)

// Importing input output classes

// Main class
class GFG {

        // Main driver method
        public static void main(String[] args) {

                // Print statement


Java contains a list of keywords or reserved words which ae also highlighted with different colors be it an IDE or editor in order to segregate the differences between flexible words and reserved words. They are listed below in the table with primary action associated with them.

1.abstractSpecifies that a class or method will be implemented later, in a subclass 
2.assertAssert describes a predicate placed in a java program to indicate that the developer thinks that the predicate is always true at that place.
3. booleanA data type that can hold True and False values only 
4.breakA control statement for breaking out of loops.
5.byteA data type that can hold 8-bit data values 
6.caseUsed in switch statements to mark blocks of text
7.catchCatches exceptions generated by try statements
8.char A data type that can hold unsigned 16-bit Unicode characters
9.classDeclares a new class
10.continueSends control back outside a loop 
11.defaultSpecifies the default block of code in a switch statement
12.doStarts a do-while loop
13.doubleA data type that can hold 64-bit floating-point numbers
14.elseIndicates alternative branches in an if statement 
15.enumA Java keyword is used to declare an enumerated type. Enumerations extend the base class.
16.extendsIndicates that a class is derived from another class or interface 
17.finalIndicates that a variable holds a constant value or that a method will not be overridden
18.finallyIndicates a block of code in a try-catch structure that will always be executed
19.floatA data type that holds a 32-bit floating-point number 
20.forUsed to start a for loop
21.ifTests a true/false expression and branches accordingly
22.implementsSpecifies that a class implements an interface 
23.import References other classes
24.instanceofIndicates whether an object is an instance of a specific class or implements an interface 
25.intA data type that can hold a 32-bit signed integer 
26.interfaceDeclares an interface
27.longA data type that holds a 64-bit integer
28.nativeSpecifies that a method is implemented with native (platform-specific) code 
29.newCreates new objects 
30.nullIndicates that a reference does not refer to anything 
31.packageDeclares a Java package
32.privateAn access specifier indicating that a method or variable may be accessed only in the class it’s declared in
33.protectedAn access specifier indicating that a method or variable may only be accessed in the class it’s declared in (or a subclass of the class it’s declared in or other classes in the same package)
34.publicAn access specifier used for classes, interfaces, methods, and variables indicating that an item is accessible throughout the application (or where the class that defines it is accessible)
35.returnSends control and possibly a return value back from a called method 
36.shortA data type that can hold a 16-bit integer 
37staticIndicates that a variable or method is a class method (rather than being limited to one particular object)
38.strictfpA Java keyword is used to restrict the precision and rounding of floating-point calculations to ensure portability.
39.superRefers to a class’s base class (used in a method or class constructor) 
40.switchA statement that executes code based on a test value 
41.synchronizedSpecifies critical sections or methods in multithreaded code
42.thisRefers to the current object in a method or constructor 
43.throw Creates an exception 
44.throwsIndicates what exceptions may be thrown by a method 
45.transientSpecifies that a variable is not part of an object’s persistent state
46.tryStarts a block of code that will be tested for exceptions 
47.voidSpecifies that a method does not have a return value
48.volatileThis indicates that a variable may change asynchronously
49.whileStarts a while loop


  • The keywords const and goto are reserved, even they are not currently in use.
constReserved for future use
gotoReserved for future use
  • true, false and null look like keywords, but in actual they are literals. However they still can’t be used as identifiers in a program.

Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more,  please refer Complete Interview Preparation Course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :