Java Reserved Keywords

Keywords are reserved words in Java that serve as a code key. These words can't be used for anything else because they're predefined. They can't be used as a variable name, object name, or any other identifier. There are 51 reserved terms or keywords in Java.

List of Java Reserved Keywords

KeywordDescription
abstractIndicates the class or method that follows this keyword is abstract and that will have to be implemented by a subclass.
assertAssert keyword helps the programmer to declare assertions or assumptions in a program. If an assertion is true, program progresses normally otherwise the AssertionError is thrown at runtime and program aborts.
booleanDefines two Boolean values, true or false, 0 and 1.
breakUsed to break out of loops or iterative constructs.
byteData type capable of holding 8-bit data.
caseMarks blocks of text (cases) in a Switch statement.
catchUsed to catch exceptions generated in the try block.
charData type able to hold unsigned 16-bit Unicode characters.
classUsed to declare a new class.
continueIt helps to take control outside the loop and continue to the next iteration.
defaultDefines the "block of code" that will execute by default in a Switch statement.
doStarting keyword for "do-while" loop.
doubleData type holding 64-bit numbers (floating-point).
elseDefines else part in the 'if' statements.
enumUsed to declare enumerations in Java.
extendsIndicates inheritance. A class is derived or inherited from another class.
finalDefines a variable which will hold constant values or a method that cannot be overridden.
finallyDefines the finally block that executes after the try-catch block irrespective of whether the exception was caught or not.
floatData type able to hold 32-bit floating-point values.
forIndicates the start of a 'for' loop.
ifStart of 'if' statement.
implementsIndicates that a class implements an interface.
importUsed to include or reference other packages/classes into the program.
instanceOfUsed to check if the given object is an instance of another class.
intData type to hold a 32-bit integer value.
interfaceUsed for declaring an interface.
longData type holding 64-bit integer values.
nativeUsed to indicate native code (platform-specific).
newOperator to create a new object.
nullIndicates null reference.
packageKeyword to declare Java package.
privateIndicates private access specified which means a variable or method can be accessed only by the class in which it is declared.
protectedThis keyword indicates a protected access specifier. When a variable or method is protected then that variable or method can be accessed only by the class they are declared in, its subclass, and other classes in the same package.
publicThe public keyword is used to indicate public access specifier. A variable, method, classes, interfaces declared as public can be accessed throughput the application.
returnReturn is used to send back the value of a method to the calling method. It also is used to return the control to the calling method.
shortData type holding 16-bit integer number values.
staticThe static keyword indicates the method or a variable is static and cannot be instantiated.
strictfpThe keyword strictfp restricts the rounding and precision of floating point values calculation. It ensures portability.
superIndicates base or superclass of the class.
switchIndicates a Switch statement that tests a condition and executes multiple cases depending on the test value.
synchronizedIndicates synchronized sections for multithreaded code like critical section.
thisThe keyword 'this' indicates the current object.
throwThrows an exception.
throwsThis indicates the exception that can be thrown by a method.
transientSpecifies transient variable that is not part of the persistent state of an object.
tryTry keywords start a block that contains code that might raise exceptions.
voidIndicates no return value.
volatileUsed to define variables that are not stored in Main Memory. They can be changed asynchronously.
whileKeyword while starts a while loop.
constThe 'const' keyword is no more supported in Java
gotoThe 'goto' keyword is no more supported in Java
true, false and nullThe words "true, false, null" are literals. Still, we cannot use them as identifiers in the program.

Next TopicJava Vs Go