Java Keywords
Access Control
Access Levels Modifier | Class | Package | SubClass | World |
---|---|---|---|---|
private | Y | Y | N | N |
protected | Y | Y | Y | Y |
public | Y | Y | Y | Y |
(default) | Y | Y | N - different package Y - same package | N |
Class & Variable & Methods
Modifier | Description |
---|---|
class | |
interface | |
default | default declare a default method in an interface |
enum | |
abstract | |
extends | |
implements | |
final | |
static | |
var | New from Java 10 |
new | |
native | |
volatile | |
synchronized | |
transient | |
strictfp |
Flow Control
Keyword | Remark |
---|---|
for | |
if | |
else | |
while | |
switch | |
case | |
break | Used in while, for, switch |
return | |
continue | |
do | |
instanceof |
Error Handle
Keyword | Remark |
---|---|
try | |
catch | |
finally | |
throw | |
throws |
Package Imports
Keyword | Remark |
---|---|
import | import a package |
package | declare a package name |
Variable Reference
Keyword | Remark |
---|---|
super | Used to invoke or reference to parent's method or variable |
this | Used to invoke or reference to current class' method or variable |
Operators
Keyword | Remark |
---|---|
. | Access a variable's method or variable |
++ | a++ or ++a |
-- | a-- or --a |
+ | |
- | |
\(*\) | |
/ | divide |
| | |
|| | |
& | |
&& | |
^ | |
% | |
! | |
= | |
? : | |
Reserved
Keyword | Remark |
---|---|
goto | Not used in Java, but kept as a keyword |
const | Not used in Java, but kept as a keyword |