Keywords or Reserve Words In JAVA - FindersAdda : Tutorials of Make Money, Computer or Internet

Monday, 20 November 2017

Keywords or Reserve Words In JAVA

In java, some words are reserve word to represents some meaning or functionality such type of words are called Reserve words.



Reserve words are the pre-defined words that have special meaning in any language. Every reserve word is reserved for a specific purpose and cannot be used as identifier.

Reserve word is also known as keyword.



keywords


There are 53 reserve words in java but only 50 reserve words are keyword and other 3 words are reserved literals.



Keywords for data type: -

byte short int long float double char boolean

Keywords for flow controls : -

if else switch case default while do for break continue return

Keywords for modifiers: -

public private protected static final abstract synchronized native strictfp (available from 1.2 version) 
transient volatile

Keywords for Exception handling: -

try catch finally throw throws assert (available from 1.4 version)

Keyword for class related: -

class interface extends implements package import

Object related keyword: -

new instanceof super this

Return type keyword: -

void


In java, return type is mandatory. If a method won’t return anything then we how to declare that method with void return type.

But in C language, return type is optional and default return type is int.

Unuser keyword: -

goto const

goto: - you says of goto create at several problem in old languages and hence Sun people banned this keyword in java.

const: - final is used instead of const.

Note: - goto and const are unuser keywords and if you are trying to use, we will get compile time error.

Reserve word literals: -

true, false, null

true and false are value for Boolean data type but null is default value for object reference.

enum keyword

We can use enum to define a group of named contants.

enum month
{
               JAN, FEB…..
}


Conclusion : -

(1) All 53 keywords in java contains only lower case alphabets symbols.

(2) In java, we have only new keyword and there is no delete keyword because destruction of useless objects is the responsibility of Garbage Collector.

(3) The following are new keywords in JAVA.
  • strictfp came in 1.2 versioin
  • assert came in 1.4 version
  • enum came in 1.5 version



I hope you liked this post so much. If you loved this post, so, share with your friends and also give some suggestion that what should i improve in this post. Thank You So Much......
 

About Author

SUMIT KUMAR GUPTA
SUMIT KUMAR GUPTA

Author & Editor

Myself Sumit Kumar Gupta & 21 year's old person. I am a programmer and blogger. I spend much more time on programming and blogging and helps other programmers and bloggers.

0 comments:

Post a Comment

We are eager to see your comments.
Comment Rule :

1. Don't use any link in the comment box. If you have any problem related to link then contact me with the contact form.

2. Don't use the wrong word if you write the wrong word in comment box then it will get spam.