Java Keywords

Below is the list of keywords in Java. The list is according to their meaning / function.

Group Keyword Meaning/Function
Class Organization package Specifies the class in a particular source file should belong to the named package.
import Requests the named class or classes be imported into the current application.
Class Definition interface Defines global data and method signatures that can be shared among classes.
class Defines a collection of related data behaviour.
extends Indicates which class to subclass.
implements Indicates the interface for which a new class will supply methods.
Keywords for Classes & Variables abstract Specifies the class cannot be instantiated directly.
public The class, method, or variable can be accessed from anywhere.
private Only the class defining the method or variable can access it.
protected Only the defining class and its subclasses can access the method or variable.
static Specifies a class method or variable.
synchronized Indicates only one object or class can access this variable or method at a time.
volatile Tells the compiler this variable may change asynchronously due to threads.
final This variable or method cannot be changed by subclasses.
const This variable cannot be changed.
native Links a method to native code.
Simple Date Types long 64-bit integer value.
int 32-bit integer value.
short 16-bit integer value.
byte 8-bit integer value.
double 64-bit floating point value.
float 32-bit floating point value.
char 16-bit Unicode character.
boolean True or False value.
void Indicates a method does not return a value.
Values & Variables FALSE Boolean value.
TRUE Boolean value.
this Current instance in an instance method.
super Immediate superclass in an instance method.
null Represents a nonexistent instance
Exception Handling throw Throws an exception.
throws Throws an exception.
try Marks a stack so that if an exception is thrown, it will unwind to this point.
catch Catches an exception.
finally Says execute this block of code regardless of exception error handling flow.
Instance Creating & Testing new Creates new instances.
instanceof Tests whether an instance derives from a particular class or interface.
Control Flow switch Tests a variable.
case Executes a particular block of code according to the value tested in the switch.
default The default block of code executes if no matching case statement was found.
break Breaks out of a particular block of code.
continue Continues with the next iteration of a loop.
goto Directs control to a specified place.
return Returns from a method, optionally passing back a value.
do Performs some statement or set of statements.
if Tests for a condition and performs some action if true.
else Performs some action if the above test was false.
for Signifies iteration.
while Performs some action while a condition is true.


Keywords which is not available from C:

auto, enum, extern, register, signed, sizeof, struct, typedef, union, unsigned


Keywords which is not available from C++:

delete, friend, inline, mutable, template, using, virtual

learn the difference between compiling & interpreted programming languages



Please enter your comment!
Please enter your name here