×

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

keywordDescription
Abstractsignifies that the class or method that comes after this keyword is abstract and must be implemented by a subclass.  
AssertDeclaring 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.  
Booleandefines true and false as the two Boolean values 0 and 1.  
Breakused to escape loops or iterative structures.  
Bytecapable of storing 8-bit data as a data type.  
Casemarks sentences (cases) within a Switch statement.  
Catchused to handle exceptions thrown by the try block.  
CarUnsigned 16-bit Unicode characters can be stored in this data format.  
Classutilized to introduce a new class.  
ContinueIt is beneficial to assume control outside of the loop and move on to the following iteration.  
DefaultDescribes the "block of code" that will automatically run in a Switch statement.  
DoThe "do-while" loop's initial keyword.  
Double64-bit number-holding data type (floating-point).  
ElseThe "if" statements, defines the else component.  
Enuma Java declaration for enumerations.  
Extendssuggests inheritance. From another class, a class can be descended or inherited.  
Finalcreates a method or variable with fixed values that cannot be changed.
FinallySpecifies the finally block, which is what happens after the try-catch block, whether or not the exception was caught.  
Floatcapable of storing 32-bit floating-point numbers.  
Forshows that a "for" loop has begun.  
Ifbegins the "if" sentence.  
Implementsshows whether a class complies with an interface.  
Importused to add more packages or classes to the program or to reference them.  
InstanceOfa tool for determining whether an object is an instance of the specified class.  
IntContains a 32-bit integer value in a data type.
Interfaceused when announcing an interface.  
Long64-bit integer values are stored in a data type.  
Nativeutilized to denote native code (platform-specific).  
NewOperator for producing new objects.  
Nullrepresents a null reference.  
PackageJava package declaration keyword.  
PrivateA 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.  
ProtectedA 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.  
PublicPublic access specifiers are denoted by the keyword public. An application can access a variable, method, class, or interface that has been marked public.  
ReturnThe calling method receives the value of a method via return. Additionally, it's utilized to give the calling method back control.  
Short16-bit integer number values are stored in a data type.  
StaticWhen a method or variable is marked as static, it means it cannot be instantiated.  
StrictfpWhen calculating floating point values, the keyword strictfp limits the precision and rounding. Portability is ensured.  
Superthe class's base or superclass is indicated.  
SwitchIdentifies a switch statement that evaluates a condition and runs different cases based on the test result.  
SynchronizedIdentifies synchronized code blocks for multithreaded programs, such as important portions.  
ThisThe word "this" designates the active object.  
Throwas a throwable exception.  
ThrowsThis shows the exception that a method is capable of throwing.  
Transientspecifies a temporary variable that is not a component of an object's persistent state.  
TryAim for keywords to start a block that contains potentially exception-raising code.  
VoidNo return value is indicated.  
Volatileused to specify variables not kept in the main memory. They are modifiable asynchronously.  
WhileA while loop is started by the word while.  
ConstJava no longer supports the "const" keyword.  
GotoJava no longer supports the 'goto' keyword.  
True, false, and nullTrue, false, and null are literals. Nevertheless, they are ineffective as program identifiers.

Related Topics

Interfaces and Classes in Strings in Java

CharBuffer: CharBuffer is utilized to implement the CharSequence interface. With the help of the mentioned class, we can allow character buffers to be utilized instead of CharSequences. We can consider the illustration...

4 minutes read.

CopyOnWriteArrayList in Java

The CopyOnWriteArrayList is used to implement the List Interface. It is the improved version of ArrayList. The operations like add, remove, set, update etc, these operations are done by creating...

5 minutes read.

Java Custom Exception

Java Custom Exception Java language facilitates us to create our own exceptions. The class intended to throw the Custom Exception has to be derived from the Java Exceptionor RuntimeExceptionclass. The Java...

4 minutes read.

Java Editors

A straightforward text editor may be used to create Java applications. However, a Java integrated programming environment (IDE) enables the software developer to create programs more quickly. An IDE offers...

4 minutes read.

Stock Span Problem Using Stack in Java

The stock span problem is an issue in finance where we must determine a stock’s price span over all N days given a set of N daily price quotes. The...

6 minutes read.

Types of Logical Operators in Java

In this tutorial, we are going to study logical operators. A logical operator is an operator that accomplishes a logical operation that is to connect two or more operations. These...

5 minutes read.

Java Math toIntExact() Method

The toIntExact() method of Java Math class returns the int value of the given long argument, throwing an exception if the value overflows an int. Syntax: public static int toIntExact (long value) Parameters: The...

2 minutes read.

Tree Implementation in Java

Introduction to Tree A non-linear, hierarchical data structure called a "tree" is made up of a number of nodes, each of which contains a values and a sequence of pointers to...

14 minutes read.

Java Int Keyword

Among the primitive data types is the Java int keyword. To declare variables, use this. It can also be used with methods that return values of the integer type. It...

3 minutes read.

Scanner in Java

Static way of Programming: When a variable can’t change its value during run time is called a Static way of programming. In this programming a variable is directly assigned to a...

4 minutes read.

Dutch National Flag Problem in Java

Dutch National Flag (DNF) is a programming issue that Edsger Dijkstra put up. The white, red, and blue hues make up the Dutch flag. The goal is to haphazardly set...

6 minutes read.

Maximizing Profit in Stock Buy Sell in Java

In this tutorial, we will deal with a popular problem, a favourite of interviewers. The problem is named as Maximising profit in stock Buy Sell. we will see certain approaches...

6 minutes read.

How to remove special characters from String in Java

Strings in Java are Objects that are supported inside by a burn exhibit. Since exhibits are immutable (cannot develop), Strings are changeless too. A completely new String is made whenever...

5 minutes read.

Static() Function in Java

The static keyword in Java is suitable for variables, constants, and functions. The static keyword is mainly used to control storage so that it may be appropriately used. We shall...

3 minutes read.

Java Project Ideas

When it comes to constructing projects, Java is regarded as one of the best languages and is also one of the most paid. Java excels in any application, whether it...

10 minutes read.

Java Math cosh() Method

The cosh() method of Math class returns the first hyperbolic cosine((e+e)/2) of a double value. Syntax: public static double cosh(double x) Parameters: The parameter ‘x’ represents the number whose hyperbolic cosine is to be...

2 minutes read.

How to run Java Program in Command Prompt

How to run Java Program in Command Prompt In this section, we will learn how to write, save, compile, and execute or run a Java program in the Command Prompt. Note: One...

3 minutes read.

Gregorian Calendar Java Current Date

GregorianCalendar class uses the Gregorian and Julian calendars. Dates are calculated by projecting present laws forever backward and forward in time. As a consequence, GregorianCalendar may be utilised to create...

8 minutes read.

Missing Number in an Arithmetic Progression in Java

Given an array that shows the elements of an orderly arithmetic progression. Find the missing number to complete the succession of elements. Example:  Input: a [ ] = {2 , 4 , 6...

3 minutes read.

How to Split String by Comma in Java

strsplit() technique permits you to break a string given the explicit Java string delimiter. The Java string split property is frequently a space or a comma(,) that you want to...

7 minutes read.