Introduction
There are some words in JAVA which we cannot use as identifier, because they are reserved and have some spatial meaning to the compiler for a specific purpose.
List of Keywords:
There are 49 keywords which are given bellow.
Types of Keywords:
There are few types of JAVA Keywords according to their uses.
Access Modifiers:
These keywords are used to control of the flow inside a block of code.
In case of error handling the following keywords are used.
For package control the following keywords are used.
Keywords given bellow are primitive datatypes.
In space of some spatial variable the following keywords are used.
There are two reserved keywords that you cannot use. They are given bellow,
There are some words in JAVA which we cannot use as identifier, because they are reserved and have some spatial meaning to the compiler for a specific purpose.
List of Keywords:
There are 49 keywords which are given bellow.
- abstract
- boolean
- break
- byte
- case
- catch
- char
- class
- const
- continue
- default
- do
- double
- else
- extends
- final
- finally
- float
- for
- goto
- if
- implements
- import
- instanceof
- int
- interface
- long
- native
- new
- package
- private
- protected
- public
- return
- short
- static
- strictfp
- super
- switch
- synchronized
- this
- throw
- throws
- transient
- try
- void
- volatile
- while
- assert
Types of Keywords:
There are few types of JAVA Keywords according to their uses.
- Access Modifiers
- Class, Method, and Variable Modifiers
- Flow Control
- Error Handling
- Package Control
- Primitives
- Variable Keywords
- Void Return Type Keyword
- Unused Reserved Words
private: This keyword restrict a method or a variable so that it can only can accessed from within its own class.
protected: This keyword restrict a method or a variable so that it can only can be accessible to classes in the same package or subclasses of the class.
public: This keyword allow a method, a variable or a class to be accessed from any other class.
Class, Method, and Variable Modifiers:protected: This keyword restrict a method or a variable so that it can only can be accessible to classes in the same package or subclasses of the class.
public: This keyword allow a method, a variable or a class to be accessed from any other class.
abstract: Used to declare a class that cannot be instantiated, or a method that must be implemented by a nonabstract subclass.
class: Keyword used to specify a class.
extends: Used to indicate the superclass that a subclass is extending.
final: Makes it impossible to extend a class, override a method, or reinitialize a variable.
implements: Used to indicate the interfaces that a class will implement.
interface: Keyword used to specify an interface.
native: Indicates a method is written in a platform-dependent language, such as C.
new: Used to instantiate an object by invoking the constructor.
static: Makes a method or a variable belong to a class as opposed to an instance.
strictfp: Used in front of a method or class to indicate that floating-point numbers will follow FP-strict rules in all expressions.
synchronized: Indicates that a method can be accessed by only one thread at a time.
transient: Prevents fields from ever being serialized. Transient fields are always skipped when objects are serialized.
volatile: Indicates a variable may change out of sync because it is used in threads.
Flow Control:class: Keyword used to specify a class.
extends: Used to indicate the superclass that a subclass is extending.
final: Makes it impossible to extend a class, override a method, or reinitialize a variable.
implements: Used to indicate the interfaces that a class will implement.
interface: Keyword used to specify an interface.
native: Indicates a method is written in a platform-dependent language, such as C.
new: Used to instantiate an object by invoking the constructor.
static: Makes a method or a variable belong to a class as opposed to an instance.
strictfp: Used in front of a method or class to indicate that floating-point numbers will follow FP-strict rules in all expressions.
synchronized: Indicates that a method can be accessed by only one thread at a time.
transient: Prevents fields from ever being serialized. Transient fields are always skipped when objects are serialized.
volatile: Indicates a variable may change out of sync because it is used in threads.
These keywords are used to control of the flow inside a block of code.
break: Exits from the block of code in which it resides.
case: Executes a block of code, dependent on what the switch tests for.
continue: Stops the rest of the code following this statement from executing in a loop and then begins the next iteration of the loop.
default: Executes this block of code if none of the switch-case statements match.
do: Executes a block of code one time, then, in conjunction with the while statement, it performs a test to determine whether the block should be executed again.
else: Executes an alternate block of code if an if test is false.
for: Used to perform a conditional loop for a block of code.
if: Used to perform a logical test for true or false.
instanceof: Determines whether an object is an instance of a class, super class, or interface.
return: Returns from a method without executing any code that follows the statement (can optionally return a variable).
switch: Indicates the variable to be compared with the case statements.
while: Executes a block of code repeatedly while a certain condition is true..
Error Handling:case: Executes a block of code, dependent on what the switch tests for.
continue: Stops the rest of the code following this statement from executing in a loop and then begins the next iteration of the loop.
default: Executes this block of code if none of the switch-case statements match.
do: Executes a block of code one time, then, in conjunction with the while statement, it performs a test to determine whether the block should be executed again.
else: Executes an alternate block of code if an if test is false.
for: Used to perform a conditional loop for a block of code.
if: Used to perform a logical test for true or false.
instanceof: Determines whether an object is an instance of a class, super class, or interface.
return: Returns from a method without executing any code that follows the statement (can optionally return a variable).
switch: Indicates the variable to be compared with the case statements.
while: Executes a block of code repeatedly while a certain condition is true..
In case of error handling the following keywords are used.
catch: Declares the block of code used to handle an exception.
finally: Block of code, usually following a try-catch statement, which is executed no matter what program flow occurs when dealing with an exception.
throw: Used to pass an exception up to the method that called this method.
throws: Indicates the method will pass an exception to the method that called it.
try: Block of code that will be tried, but which may cause an exception.
assert: Evaluates a conditional expression to verify the programmer’s assumption.
Package Control:finally: Block of code, usually following a try-catch statement, which is executed no matter what program flow occurs when dealing with an exception.
throw: Used to pass an exception up to the method that called this method.
throws: Indicates the method will pass an exception to the method that called it.
try: Block of code that will be tried, but which may cause an exception.
assert: Evaluates a conditional expression to verify the programmer’s assumption.
For package control the following keywords are used.
import: Statement to import packages or classes into code.
package: Specifies to which package all classes in a source file belong.
Primitives:package: Specifies to which package all classes in a source file belong.
Keywords given bellow are primitive datatypes.
boolean, byte, char, double, float, int, long, short
Variable Keywords:In space of some spatial variable the following keywords are used.
super: To refer to the immediate superclass this keyword is used.
this: To refer to the current instance of an object this keyword is used.
Void Return Type Keyword:this: To refer to the current instance of an object this keyword is used.
void: It indicates that there is no return type for the method.
Unused Reserved Words: There are two reserved keywords that you cannot use. They are given bellow,
goto(harmful for the program), const(should use public static final)






Comments
Write New Comment ▼
Write New Comment
Sorry! This knol's owner(s) have blocked you from editing, making suggestions, or commenting here.