Keywords:
A keyword or reserved word in Java has a special meaning and cannot be used as a user defined identifier, because they are used by the compiler and if you use them as variable names, compiler will generate errors.
Keywords (53)
Keywords (50)
Used keywords(48)
Primitive data type (8): byte, short, int, long, float, double, char, boolean
Control flow (11): if, else, for, do, while, switch, case, break, continue, default, return
Modifiers (11): public, protected, private, static, final, abstract, synchronized, native, transient, volatile, strictfp
Exception Handling (6): try, catch, throw, throws, finally, assert
Class Related(7): class, interface, enum, extends, implements, import, package
Object related(4): this, super, instanceof, new
Return type(1): void
Unused keywords (2): goto, const
Reserved Words (3): true, false, null
Keywords in Java and their meaning/purpose:
abstract |
It declares that a class or method is abstract |
assert |
Used to specify assertions |
boolean |
Declares that variable is Boolean type |
break |
Used to exit a loop before end of the loop is reached |
byte |
Declares that variable is byte type |
case |
To represent different conditions in switch statement |
catch |
Used for handling exceptions, i.e., capture the exceptions thrown by |
some actions |
|
char |
Declares that variable is character type |
class |
Signals the beginning of a class definition |
const |
This keyword is reserved by Java but now it is not in use |
continue |
Prematurely return to the beginning of a loop |
default |
Default action in switch statement |
do |
Begins a do while loop |
double |
Declares that variable is double type |
else |
Signals the code to be executed when if condition executes to false |
extends |
Specifies the class base from which the correct class is inherited |
final |
Declares that a class may not be extended or that a field or method may |
not be overridden |
|
finally |
Declares a block of code guaranteed to be executed |
float |
Declares a floating point variable |
for Start a for loop |
|
goto |
This keyword is reserved by Java but now it is not in use |
if |
Keyword to represent conditional statement |
implements |
Declares that this class implements the given interface |
import |
permits access to a class or group of classes in a package |
Instance of |
tests whether an object is an instance of a class |
int |
Declares an integer variable |
interface |
signals the beginning of an interface definition |
long |
Declares a long integer variable |
native |
Declares that a method that is implemented in native code |
new |
Allocates memory to an object dynamically |
package |
Defines the package to which this source code file belongs |
private |
Declares a method or member variable to be private |
protected |
Declares a class, method or member variable to be protected |
public |
Declares a class, method or member variable to be public |
return |
Returns a value from a method |
short |
Declares a short integer variable |
static |
Declares that a field or a method belongs to a class rather than an object |
strictfp |
To declare that a method or class must be run with exact IEEE 754 semantics |
super |
A reference to the parent of the current object |
switch |
Tests for the truth of various possible cases |
synchronized |
Indicates that a section of code is not thread-safe |
this |
A reference to the current object |
throws |
Declares the exceptions thrown by a method |
transient |
Data should not be serialized |
try |
Attempt an operation that may throw an exception |
void |
Declare that a method does not return a value |
volatile |
Warns the compiler that a variable changes asynchronously |
while |
Begins a while loop |
The words true, false, and null are reserved words. Keywords ‘const’ and ‘goto’ are currently not in use. In this list of Keywords the new Keywords have also been added, for exapmle Java 1.2 adds the strictfp keyword to declare that a method or class must run with exact IEEE 754 semantics. Java 1.4 adds the assert keyword to specify assertions.