Keywords of The Java Programming Language (Java 8)
Keywords of The Java Programming Language (Java 8)
Keywords of The Java Programming Language (Java 8)
Access level:
private protected public
Other modifier:
final static
Type:
boolean byte char double float int long short
Note that classes like String when used as types are not keywords, they are identifiers (names)!
Keywords of interest - method declarations
For declaring methods of a class:
Access level:
private protected public
Other modifier:
abstract final static
Type:
boolean byte char float double int long short void
Exception signal:
throws
Keywords of interest - code which does something
The following keywords are used when writing code which doesn something,
like the body of constructors and methods (and initializers):
Control flow:
continue for if break else return switch case while finally
Errors and exceptions:
assert throw try catch
(Local) Variable declarations:
boolean byte char double float int long short
final
Tests:
instanceof
Dereferencing
this super
Creation:
new
The rest (outside of the scope of this book/course)
Thread syncronization:
synchronized
Serialization:
transient
Floating point calculations:
strictfp
Concurrency/atomicity:
volatile
Methods written in other languages (differ between Java installations):
native
Java 8 interface default method modifier:
default
Further reading
● https://docs.oracle.com/javase/specs/jls/se8/html/jls-3.html#jls-3.9
● https://docs.oracle.com/javase/tutorial/essential/concurrency/atomic.htm
l
● https://docs.oracle.com/javase/tutorial/essential/concurrency/syncrgb.ht
ml
● https://docs.oracle.com/javase/tutorial/java/IandI/defaultmethods.html