Reserved Words in Java

Some identifiers are reserved to associate some functionality or to represent values, such type of reserved identifiers are called “ReservedWords”.




Keywords for Datatypes

byte, short, int, long, float, double, char, boolean

Keywords for FlowControl

if, else, switch, case, default, do, while, for, break, continue, return

Keywords for ExceptionHandling

try, catch, finally, throw, throws, assert

Keywords for Modifers

public, private, protected, final, abstract, static, native, synchronized, volatile, transient, strictfp

Class Related Keywords

class, interface, package, extends, implements, import

Object Related Keywords

new, instanceof, super, this

void return type Keywords

if a method doesn’t return anything compulsory that method should be with void return type

Un-used Keywords

goto - in java usage is considered as harmful.
const -  alternatively we should use final keyword.

Enum Keyword

This keyword has introduced in 1.5 version, to define user defined data types.
Ex:

enum Month
{
JAN,FEB,MAR,....DEC;
}

Reserved Literals

true, false-  Allowed values for boolean data types
null-  Default value for object reference

Which of the following are valid java Reserved words ?

1) int, float, signed, double
2) abstract, final, volatile, virtual
3) new, delete
4) goto, constant, static
5) byte, short, int, long

Ans- 5