RESERVED WORDS IN JAVA

 

 

Keyword               Contextual Description

 

abstract               Used in a class definition to specify that a class is not to be instantiated, but rather inherited by other classes

boolean                Refers to an expression or variable that can have only a true or false value

break                    Terminates processing of a switch statement or loop

byte                      A sequence of eight bits

case                      Used in a switch statement to specify a match for the statement's expression

catch                    Used to specify the actions to be taken when an exception occurs (see throw, try)

char                      Declares objects whose values are characters

class                     Construct new types to describe data and operations

continue              Used in a loop statement to transfer control to the beginning of the loop

default                 Used in a switch statement to handle expression values not specified using case

do                          Marks the beginning of a do-while statement

double                  Declares objects whose values are double precision real numbers

else                       Used as the alternative action of an if statement

extends                Used to specify that a subclass inherits the methods of a superclass

final                      An entity that is defined once and cannot be changed or derived from later

finally                  Executes a block of statements regardless of whether a Java Exception, or run time error, occurred in a block defined previously by the "try" keyword

float                      Declares a primitive data type whose values are single precision real numbers

for                         Marks the beginning of a for statement

if                           Marks the beginning of an if statement

implements        Optionally included in the class declaration to specify any interfaces that are implemented by the current class

import                 Used at the beginning of a source file that can specify classes or entire packages to be referred to later without including their package names in the reference

instanceof           tests whether the run-time type of its first argument is assignment compatible with its second argument

int                         Declares objects whose values are integer numbers

interface              used to define a collection of method definitions and constant values

long                      Used to declare a primitive data type with values that range from

new                       Allocates memory dynamically at run-time

package               A group of types

private                 Declares class members that are inaccessible from outside of the class

protected            Declares class members that are private, except to derived classes

public                  Declares class members that can be accessed outside of the class

return                  Terminates a function, usually returning the value of some expression

short                    Used to declare 16-bit integer numbers

static                    Declares objects whose lifetime is the duration of the program

super                    Used to access members of a class inherited by the class in which it appears

switch                  Marks the beginning of a switch statement

synchronized      When applied to a method or code block, guarantees that at most one thread at a time executes that code

this                       Used with a class member to unambiguously access other members of the class

throw                   Used to generate an exception (see catch, try)

throws                 Used in method declarations that specify which exceptions are not handled within the method but rather passed to the next higher level of the program

try                         Used to mark the beginning of a block containing exception handlers (see catch)

void                      Used to indicate the absence of any type (for a function or parameter list)

while                    Marks the beginning of a while statement, as well as the end of a do-while statement