JAVA KEYWORDS

 

Java   keywords  are   set   of predefined  words  provided  by   java  vendor which is  also  called  reserved  words.  These   keywords  can’t be  used  as  object  names,variable names, method names  or  class  names.

 

 

Now, let us  go through a  java  program  using    java keywords.

 

 

Example:

 

 

//Java  program  using  keywords

 

class  Employee{

public  static  void  main(String  args[]){

//using final and  int  keyword

int  grade=2;

//using if  and  else  keywords

if(grade>2){

System.out.println(“Salary of the employee is less than $50k”);

}

else{

System.out.println(“Salary of the employee is  more  than $50k”);

}

}

}

 

 

 

 

 

Java  Keywords  List

 

 

Till  Java 21,there  are  53  keywords  defined  in  java.

 

In  the  list  of  keywords, 2  keywords  are  unimplemented  or  unused  keyword  which are  const goto.

In Java  true,false and null   are  reserved  literals. These 3 literals  can’t be  used  as  identifiers in  java  program.

 

In  Java, keywords  are  case  sensitive  and  writing  Java  keywords in  upper case (like  VOID  instead  of  void) will  throw  an  error.

 

 

 

Leave a Comment

Your email address will not be published. Required fields are marked *