Tuesday, March 14, 2017

Reserve Words in java.

Reserve Words

There are few words in java which are reserved for some meaning or functionality, these words in java called Reserved Worlds.

There are 53 reserve words in java.
Reserved Word Chart
























goto:-  As use of goto keywords creates several  problem in old programing language ,hence SUN people decide not to used “goto” keywords and band it in java.


const :- use final instead of const.

Note:- In java return type is mandatory for the methods , if method doesn’t return anything than its return type is void.
BUT
In c-language return type is optional and default return type is int.

Goto and const keyword is unused keyword if we try to use it than we will get CE.


enum- we use enum to define a group of named constant.
Ex:
enum month {
jan,feb,mar,…..dec;
}


Conclusion :-
  1. All reserve words in java only contain lower case-alphabets symbols
  2. In java we have only new keyword but not delete keyword because in java destruction of unused  object  is responsibility of java Garbage collector.


Things to aware:
  • strictfp but not strictFp.
  • instanceof but not instanceOf
  • extends but not extend
  • implements  but not implement
  • import  but not imports
  • synchronized but not synchronize
  • const but not consant

No comments:

Post a Comment