bscodinglab

Keywords

Keywords are reserved words in Java that have special meaning to the compiler. They cannot be used as identifiers for classes, variables, or methods. Because they serve predefined purposes in the language. Here, I’ll provide a list of Java keywords and a brief explanation of their usage:

Table Header
abstract 5
default
if
protected
Throws
assert
do
implements
public
Transient
boolean
double
import
return
try
break
else
instanceof
short
Void
byte
enum
int
static
Volatile
case
extends
interface
strictfp
var (Added in Java 10 for local variable type inference)
catch
final
long
super
while
char
finally
native
Switch
yield (Added in Java 13 for switch expressions
class
float
new
Synchronized
Const (Not used, reserved for future use)
for
package
This
continue
Goto (Not used, reserved for future use)
private
Throw

Please note that the list above is based on the Java language specifications up to Java 20. New versions of Java may introduce additional keywords or modify the use of existing ones.

Here are some of the most common used keywords in Java:

  • Abstract :- Used to declare an abstract class.
  • Class :- Used to declare a class.
  • Public :- Used to declare a public class, method, or field.
  • Private :- Used to declare a private class, method, or field.
  • Static :- Used to declare a static method or field.
  • Void :- Used to declare a method that does not return a value.
  • New :- Used to create a new object.
  • This :- Used to refer to the current object.
  • Super :- Used to refer to the parent class.