Here are the summary of the available keywords in the Java programming language. Keywords are reserved words that already taken and internally used by Java, so we cannot create variables and name it using this keyword.
Keyword | Meaning |
---|---|
abstract |
an abstract class or method |
assert |
used to locate internal program errors |
boolean |
the Boolean type |
break |
breaks out of a switch or loop |
byte |
the 8-bit integer type |
case |
a case of a switch |
catch |
the clause of a try block catching an exception |
char |
the Unicode character type |
class |
defines a class type |
const |
not used |
continue |
continues at the end of a loop |
default |
the default clause of a switch |
do |
the top of a do/while loop |
double |
the double-precision floating-number type |
Keyword | Meaning |
---|---|
else |
the else clause of an if statement |
enum |
define an enum type |
extends |
defines the parent class of a class |
final |
a constant, or a class or method that cannot be overridden |
finally |
the part of a try block that is always executed |
float |
the single-precision floating-point type |
for |
a loop type |
goto |
not used |
if |
a conditional statement |
implements |
defines the interface(s) that a class implements |
import |
imports a package |
instanceof |
tests if an object is an instance of a class |
int |
the 32-bit integer type |
interface |
an abstract type with methods that a class can implement |
long |
the 64-bit long integer type |
Keyword | Meaning |
---|---|
native |
a method implemented by the host system |
new |
allocates a new object or array |
null |
a null reference |
package |
a package of classes |
private |
a feature that is accessible only by methods of this class |
protected |
a feature that is accessible only by methods of this class, its children, and other classes in the same package |
public |
a feature that is accessible by methods of all classes |
return |
returns from a method |
short |
the 16-bit integer type |
static |
a feature that is unique to its class, not to objects of its class |
strictfp |
Use strict rules for floating-point computations |
super |
the superclass object or constructor |
switch |
a selection statement |
synchronized |
a method or code block that is atomic to a thread |
this |
the implicit argument of a method, or a constructor of this class |
Keyword | Meaning |
---|---|
throw |
throws an exception |
throws |
the exceptions that a method can throw |
transient |
marks data that should not be persistent |
try |
a block of code that traps exceptions |
void |
denotes a method that returns no value |
volatile |
ensures that a field is coherently accessed by multiple threads |
while |
a while loop type |
Latest posts by Wayan (see all)
- How do I get number of each day for a certain month in Java? - September 8, 2024
- How do I get operating system process information using ProcessHandle? - July 22, 2024
- How do I sum a BigDecimal property of a list of objects using Java Stream API? - July 22, 2024