Java Keywords
Java includes a collection of reserved words, known as keywords, which cannot be employed as identifiers for variables, methods, classes, or any other programming constructs.
List of Java Keywords:
Keyword Description
abstract abstract keyword is used to declare abstract classes and methods. An abstract class can not be used to create an object. but it can provide the implementation of the interface. moreover, It can have abstract and non-abstract methods.
assert It is used for debugging
boolean boolean data type is used to store true and false value.
break break keyword is used to break the loop or switch statements. simple it breaks the program flow.
byte It is data type that can store numbers from -128 to 127.
case It is used for write case block in switch statement.
catch Catch keyword is used to catch the exceptions which is generated by try block. It always placed after try.
char This datatype is used to store single character value.
class class keyword is used to declare class.
continue continue keyword is used to to continue the loop. so basically continues to the next iteration of a loop.
default It is used to specify default block in switch case statements.
do Used together with while loop to create do-while loop
double double keyword is used to declare a variable that can hold 64 bit floating value.
else It is used for add condition with if statements.
enum Declares an enumerated type.
extends extend keyword is used in inheritance and interface where you can derived class from another class or interface.
final final keyword is used to denote constants. It can be used with variables, methods and classes. We can not change the value of final variable.
finally finally keyword used with exceptions, finally block of code will be executed no matter if there is an exception or not.
float It is one type of datatype. Generally it is used to store floating(Pointing Value) data.
for Creates for loop. Provides functionality to perform set of operations repeatedly.
if If keyword tests the condition. execute the block if condition is true.
implements Implements keyword implement interface.
import Used to import Packages, class and Interface.
instance of Instance of keyword is used to checks whether an object is an instance of a specific class or an interface
long It is a data type and it can hold a 64-bit integer.
native Specifies that a method is not implemented in the same Java source file (but in another language)
new Creates new objects
Package Declares a package
Private Private is access modifier. it is used to indicate that method or variable maybe accessed only in class which it is declared.
Protected An access modifier used for attributes, methods and constructors, making them accessible in the same package and subclasses
Public An access modifier used for classes, attributes, methods and constructors, making them accessible by any other class
return Finished the execution of a method, and can be used to return a value from a method
short It is a data type and it can hold a 16-bit integer.
static It is non-access modifier used for methods and attributes. Static methods and attributes can be accessed without creating an object.
strictfp Restrict the precision and rounding of floating point calculations
super Refers to Superclass(Parent class) object into child class
switch The switch statement tests the equality of a variable against multiple values.
synchronized This keyword is used in multithreading, which specifies that methods can only be accessed by one thread at time.
this this keyword can be used to refer the current object in a method or constructor.
throw It is used to explicitly throw an exception and mainly used to create custom exceptions.
throws Java throws keyword is used to declare an exception. Checked exceptions can be propagated with throws.
transient Java transient keyword is used in serialization. If you define any data member as transient, it will not be serialized.
try Creates a try…catch statement
void Specifies that a method should not have a return value
volatile Java volatile keyword is used to indicate that a variable may change asynchronously.
while Creates a while loop