Java Keywords

Keyword is a reserved word in programming language which is predefined. Because it has a special meaning. keyword cannot be used as name for class, method and function. Keyword cannot be used as a identifier.


 
Ads

Java Keywords

Keyword is a reserved word in programming language which is predefined. Because it has a special meaning. keyword cannot be used as name for class, method and function. Keyword cannot be used as a identifier also. There are few keyword in java as follows:

abstract: abstract keyword is used to declare class, method. If a class is declared as abstract then we cannot create the object of  that class. Abstract keyword is used to declare a method without providing the implementation.

assert : assert keyword is used  to make assertion. It is used to test the assumption about your program.

boolean :  boolean keyword is used to store boolean value that is true or false. This keyword is also used to declare a method that return a value of  type boolean.

break : Used to come out from the program execution immediately following the enclosing statement block.

case :  case keyword is used in switch case to create individual cases.

catch : This keyword is used to handle the exception that occurred in the program preceding by try block.

class : This keyword is used to defined the implementation of  particular object .

const : It is a keyword in java but not used hence it has no function.

continue : continue is a keyword that is used to resume program execution to the end of the loop body.

default : default keyword is used in the switch statement, if no matches found in switch cases, then default statement is executed.

do :  do keyword is used with while loop, which execute the block of code associated with the loop.

else : else keyword is used with if to create if-else statement that check the boolean expression. It return true when the statement within if is executed, return false when statement within else will executed.

enum : enum keyword is used to declare enumerated type.

final : Used to defined a class, method and variable. If a class defined as final it cannot be inherited by subclass, if a variable is defined as final variable it  cannot be changed  and final method cannot be overridden..

goto : goto is a reserved word in java but not used  hence it has no function.

new : used to create an instance of class.

public : is used to declare class, method and field ; public class, method and field can be accessed by any class.

void : void keyword is used to declare a method that does not return any value. 

 

Advertisements

Share on Google+Share on Google+

Java Keywords

Posted on: May 10, 2013 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

Ads
 

Discuss: Java Keywords  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0

Ads

 

Ads