Skip to main content
Logo image

Java, Java, Java: Object-Oriented Problem Solving, 2022E

Appendix D Java Keywords

The words shown in Table D.1 are reserved for use as Java keywords and cannot be used as identifiers. The keywords const and goto, which are C++ keywords, are not actually used in Java. They were included mainly to enable better error messages to be generated when they are mistakenly used in a Java program.
The words true, false, and null may look like keywords but are technically considered literals. They also cannot be used as identifiers.
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
Figure D.0.1. Java keywords. Those with * are not used.