Java Keywords:
Keywords in Java are also known as reserved words. These are the predefined words
therefore they can’t be used as a variable name. If we will use keywords as a variable
name, the result will be a compile-time error. The list of all the Java Keywords is given
below.
abstract final protected
assert finally public
boolean for return
break float short
byte if static
catch implements super
char import switch
case instanceOf synchronized
class int this
continue interface throw
default long throws
do native transient
double new try
else null void
enum package volatile
extends private while
Examples:
Correct
int x = 10;
int _x = 10;
int $x = 10;
Int x1 = 10;
1
Incorrect
int 1x = 10;
int num ber = 10;