Java keyword
A Java keyword is one of 50 reserved terms that have a special function and a set definition in the Java programming language. The fact that the terms are reserved means that they cannot be used as identifiers for any other program elements, including classes, subclasses, variables, methods and objects.
Keywords in the Java programming language
(See some examples of keyword functions below the table.)
abstract |
continue |
for |
new |
switch |
assert |
default |
goto |
package |
synchronized |
boolean |
do |
if |
private |
this |
break |
double |
implements |
protected |
throw |
byte |
else |
import |
public |
throws |
case |
enum |
instanceof |
return |
transient |
catch |
extends |
int |
short |
try |
char |
final |
interface |
static |
void |
class |
finally |
long |
strictfp |
volatile |
const |
float |
native |
super |
while |
A few examples of Java keyword functions:
The abstract keyword, placed before class, prevents that class from being directly instantiated.
The assert keyword, placed before a true or false statement known as a predicate, indicates that the programmer believes the statement to always be true. If it proves otherwise, an assertion exception occurs.
The const keyword defines a variable or pointer as unchangeable.