Java Keywords

    Java keywords are reserved words that cannot be used as any variable or object name. These keywords have some meaning in Java and perform some actions.

    Java Keywords List

    The following is the list of the keywords available in Java:

    Keyword Description
    abstract It is used to declare the abstract class , which implements the interface .
    boolean You can declare the variable as a boolean, which can hold true or false values.
    break This keyword will allow you to break the control statement flow at the specified condition to be true.
    byte This keyword can be used to declare the variable that can store 8-bit of data.
    case You can use this keyword with a switch statement for defining different conditions.
    catch This keyword can catch the exception generated by the try statement. This catch block always follows the try block.
    char This keyword lets you declare the char variable to hold 16-bit Unicode characters.
    class This keyword will allow you to declare the class.
    continue The continue keyword will continue the loop once this keyword is encountered and skip the remaining code afterward.
    default This keyword will specify the default block in the switch statement.
    do This keyword will declare the loop in the control statement to iterate it at the specified time.
    double This keyword will allow you to store the 64-bit floating-point number.
    else This keyword specifies the alternate for the if statement block.
    enum It will define the set of constants that can be either private or default.
    extends This keyword will specify that the class is derived from another class.
    final This will specify that the variable is holding a constant value and will restrict the user.
    finally This is a code block in the try-catch structure that will be executed whether an exception is raised or not.
    float You can declare a variable that can hold a 32-bit floating-point number
    for This will specify the start of the for loop, executed until the condition holds true.
    if This allows you to test the condition, and the code will be executed if the condition is true.
    implements It helps you to implement the interface.
    import You can import the classes or interface to the current code to make it accessible.
    instanceof It specifies that a given object is an instance of the given class
    int You can declare a variable that holds a 32-bit integer.
    interface It allows you to declare an interface that can have abstract methods.
    long It will declare a variable that holds a 64-bit integer.
    native It specifies that a method is implemented in native code using JNI.
    new This keyword allows you to create a new object.
    null It indicates that a reference does not refer to anything and removes the garbage value.
    package It will declare a Java package that includes the classes.
    private It is an access modifier that can be accessed within the package.
    protected This is an access modifier that can be accessed within the package or outside through inheritance.
    public This is an access modifier and can be accessed throughout the package.
    return It is used to return from the method after its completion.
    short It will declare a variable that can hold a 16-bit integer.
    static It specifies that a variable or method is a class method.
    strictfp It will restrict the floating-point calculations.
    super It is a reference variable that will refer to the parent class object.
    switch This specifies the switch statement, which will execute the switch code block.
    synchronized This will specify the critical section of the multithreaded code.
    this It will specify the current object in the method.
    throw This keyword will throw the exception in the code.
    throws This will be used to declare an exception.
    transient This keyword is used in serialization.
    try This block is used to test the code for the exception.
    void This will specify that the method will not return anything.
    volatile It specifies that the variable may change asynchronously.
    while This will start the while loop .