Java – Keywords

Keywords in Java

package: Keyword is used to declare a Java package
import: Keyword is used to import other classes to refer them

class: Keyword is used decalre a Class
interface: Keyword is used decalre an Interface

extends: Indication for a class that it is derived from other class
implements: Indication for a class that it implements interface
new: Creates new Object
instanceof: Keyword is used to test whether the object is an instance of specified type (class or interface)

boolean: Data type (Can hold true/false values)
char: Data type (Can hold 16-bit unsigned unicode characters)
byte: Data type (Can hold 8-bit data values)
short: Data type (Can hold 16-bit integer)
int: Data type (Can hold 32-bit signed integer)
long: Data type (Can hold 64-bit integer)
float: Data type (Can hold 32-bit floating-point number)
double: Data type (Can hold 64-bit floating-point number)

true: Literal
false: Literal
null: Literal

this: Keyword is used to refer current object in method or constructor
super: Keyword is used to refer parent object in method or constructor

if: Conditional Statement
else: Conditional Statement
switch: Conditional Statement
case: Conditional Statement
default: Conditional Statement

do: Keyword is used to start a do-while loop
while: Keyword is used to start a while loop
break: Control statement to break entire flow of loop
continue: Control statement to break current flow of loop
for: Keyword is used to start a for loop

try: Block of code that will be tested for exceptions
catch: Catches exception thrown in try block
finally: Block of code in a try-catch structure that guarantees to be executed
throw: Exception Handling
throws:

native: Keyword is used to specify that a method is implemented with native (platform specific) code
private: Access Specifier
protected: Access Specifier
public: Access Specifier
abstract: Keyword is used to specify that a class or method will be implemented later in subclass
static: Keyword is used to declare or method as class member
default: Keyword is used to declare default method in interface

void: Keyword is used to specify that a method does not have a return value
return: Keyword is used in methods to return a value
final: Keyword is used to specify that variables are constants and methods cannot be overriden

volatile: Keyword is used in multithreaded environment where variable can be changed asynchronously
synchronized: Keyword is used to control simultaneous access of method or block by multiple threads

goto: Reserved – Not in use
const: Reserved – Not in use

outer:
var:
future:
generic:
cast:
operator:
rest:

Author: Mahesh

Technical Lead with 10 plus years of experience in developing web applications using Java/J2EE and web technologies. Strong in design and integration problem solving skills. Ability to learn, unlearn and relearn with strong written and verbal communications.