Reserved Keywords in Java
In Java, a reserved term is used as a code key called a keyword. Because they are predefined, these terms cannot be used for anything else. They cannot serve as a name for a variable, an object, or any other type of identifier. In Java, there are 51 reserved phrases or keywords.
Java Reserved Keywords List
keyword | Description |
Abstract | signifies that the class or method that comes after this keyword is abstract and must be implemented by a subclass. |
Assert | Declaring assertions or assumptions in a program is made easier by the assert keyword. If an assertion is true, the program continues normally; if not, an AssertionError is raised at runtime, and the program terminates. |
Boolean | defines true and false as the two Boolean values 0 and 1. |
Break | used to escape loops or iterative structures. |
Byte | capable of storing 8-bit data as a data type. |
Case | marks sentences (cases) within a Switch statement. |
Catch | used to handle exceptions thrown by the try block. |
Car | Unsigned 16-bit Unicode characters can be stored in this data format. |
Class | utilized to introduce a new class. |
Continue | It is beneficial to assume control outside of the loop and move on to the following iteration. |
Default | Describes the "block of code" that will automatically run in a Switch statement. |
Do | The "do-while" loop's initial keyword. |
Double | 64-bit number-holding data type (floating-point). |
Else | The "if" statements, defines the else component. |
Enum | a Java declaration for enumerations. |
Extends | suggests inheritance. From another class, a class can be descended or inherited. |
Final | creates a method or variable with fixed values that cannot be changed. |
Finally | Specifies the finally block, which is what happens after the try-catch block, whether or not the exception was caught. |
Float | capable of storing 32-bit floating-point numbers. |
For | shows that a "for" loop has begun. |
If | begins the "if" sentence. |
Implements | shows whether a class complies with an interface. |
Import | used to add more packages or classes to the program or to reference them. |
InstanceOf | a tool for determining whether an object is an instance of the specified class. |
Int | Contains a 32-bit integer value in a data type. |
Interface | used when announcing an interface. |
Long | 64-bit integer values are stored in a data type. |
Native | utilized to denote native code (platform-specific). |
New | Operator for producing new objects. |
Null | represents a null reference. |
Package | Java package declaration keyword. |
Private | A variable or method can only be accessed by the class in which it is declared when it is marked with the private access specified sign. |
Protected | A protected access specifier is indicated by this term. When a variable or method is protected, only the class in which it is defined, its subclass, and other classes in the same package are permitted to access that variable or method. |
Public | Public access specifiers are denoted by the keyword public. An application can access a variable, method, class, or interface that has been marked public. |
Return | The calling method receives the value of a method via return. Additionally, it's utilized to give the calling method back control. |
Short | 16-bit integer number values are stored in a data type. |
Static | When a method or variable is marked as static, it means it cannot be instantiated. |
Strictfp | When calculating floating point values, the keyword strictfp limits the precision and rounding. Portability is ensured. |
Super | the class's base or superclass is indicated. |
Switch | Identifies a switch statement that evaluates a condition and runs different cases based on the test result. |
Synchronized | Identifies synchronized code blocks for multithreaded programs, such as important portions. |
This | The word "this" designates the active object. |
Throw | as a throwable exception. |
Throws | This shows the exception that a method is capable of throwing. |
Transient | specifies a temporary variable that is not a component of an object's persistent state. |
Try | Aim for keywords to start a block that contains potentially exception-raising code. |
Void | No return value is indicated. |
Volatile | used to specify variables not kept in the main memory. They are modifiable asynchronously. |
While | A while loop is started by the word while. |
Const | Java no longer supports the "const" keyword. |
Goto | Java no longer supports the 'goto' keyword. |
True, false, and null | True, false, and null are literals. Nevertheless, they are ineffective as program identifiers. |