keyword : Java Glossary

*0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ (all)

keyword
Reserved Keywords Learning More
What keywords Can Be Applied to What Links
Keyword Order

Reserved Keywords

Java reserves some words. They cannot be used as variable, method or class names.

Java Keywords
abstract default if private this
assert do implements protected throw
Boolean double import public throws
break else instanceof return transient
byte enum int short try
case extends interface static void
catch final long strictfp volatile
char finally native super while
class float new switch
continue for package synchronized
Reserved keywords (not currently in use)
const goto      
Reserved Literals
null true false    

The bold ones I consider more important since they demark major blocks of code. assert arrived with JDK (Java Development Kit) 1.4. enum arrived with JDK 1.5. const and goto are not currently used. They may be there just in case C++ programmers use them by mistake to enable the compiler to give a more meaningful error message.

What keywords Can Be Applied to What

  variable local variable method class interface inner class code block
public 4 7
protected
private
abstract 1 7
static 2
final 3 4 4
native 5
synchronized
volatile 6
transient
strictfp

Notes

1 — abstract methods cannot have a body.

² — static blocks may not occur inside methods.

3 — final methods cannot be overridden in a subclass. This is not the same as C++ const.

4 — you can’t derive from a final class.

5 — implemented in some other language, usually C, C++ or assembler.

6 — May be asynchronously modified by other threads. Volatile is not a substitute for task synchronization.

7 — Interfaces and all their methods are public abstract by default. It is considered poor form to explicitly code the public abstract.

Table composed by Razvan.

Keyword Order

In theory it does not matter if you say public static final or final static public, but if you follow the usual convention, other people will able to read your code more easily. The Java language specification makes recommendations about the order of modifiers. It strongly encourages the following order:

Learning More

Oracle’s Javadoc on Modifier class : available:

This page is posted
on the web at:

http://mindprod.com/jgloss/keyword.html

Optional Replicator mirror
of mindprod.com
on local hard disk J:

J:\mindprod\jgloss\keyword.html
Canadian Mind Products
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.

IP:[65.110.21.43]
Your face IP:[18.218.61.16]
You are visitor number