List of Java keywords
In the Java programming language, a keyword is any one of 68 reserved words that have a predefined meaning in the language. Because of this, programmers cannot use keywords in some contexts, such as names for variables, methods, classes, or as any other identifier. Of these 68 keywords, 17 of them are only contextually reserved, and can sometimes be used as an identifier, unlike standard reserved words. Due to their special functions in the language, most integrated development environments for Java use syntax highlighting to display keywords in a different colour for easy identification.
Reserved keywords
The following words are reserved keywords and cannot be used as identifiers under any circumstances.;
_;
abstract;
assert ;
boolean;
break;
byte;
case;
catch;
char;
class;
continue;
default;
do;
double;
else;
enum ;
extends;
final;
finally;
float;
for;
if;
implements;
import;
instanceof;
int;
interface;
long;
native;
new;
package;
private;
protected;
public;
return;
short;
static;
super;
switch;
synchronized;
this;
throw;
throws;
transient;
try;
void;
volatile;
whileUnused
The following words are reserved as keywords, but currently have no use or purpose.;
const;
goto;
strictfpContextual keywords
The following identifiers are contextual keywords, and are only restricted in some contexts:;
exports;
module;
non-sealed;
open;
opens;
permits;
provides;
record;
requires;
sealed;
to;
transitive;
uses;
var;
when;
with;
yieldReserved words for literal values
The following words refer to literal values used by the language.;
true;
false;
null