Java Keywords Reference¶
Java has a set of reserved words that cannot be used as variable names.
| Keyword | Description |
|---|---|
abstract |
Declares an abstract class or method. |
break |
Breaks out of a loop or switch. |
class |
Declares a new class. |
extends |
Indicates that a class is a subclass of another. |
final |
Indicates a value cannot be changed. |
implements |
Indicates that a class implements an interface. |
import |
Brings in external classes or packages. |
instanceof |
Checks if an object is an instance of a specific class. |
interface |
Declares a new interface. |
new |
Creates a new object. |
package |
Declares a package. |
private |
Only accessible within the class. |
protected |
Accessible in package and subclasses. |
public |
Accessible from anywhere. |
return |
Returns a value from a method. |
static |
Belongs to the class, not an object. |
super |
Refers to the superclass object. |
this |
Refers to the current object. |
throw / throws |
Used for handling exceptions. |
void |
Specifies that a method has no return value. |
Checking Keywords
This list is not exhaustive. For a full list of all 50+ keywords, refer to the official Java Documentation.