Keyword vs Reserved word Java

Keyword vs Reserved word Java

Keyword vs Reserved

Java comes with total 53 keywords words that cannot be used in programming.

  1. 48 Keywords as on JDk 1.5 release (from JDK 1.5 to 1.8 nothing is added to list).
  2. 2 Reserved words of "const" and "goto".
  3. 3 Literals of true, false and null.
Let us go in detail on Keyword vs Reserved word Java

.

  1. Keywords: Keywords has special meaning (functionality) to the compiler. For this reason they cannot be used as identifiers in coding.
  2. Reserved words: When Java was developed Designers wanted to eliminate two words const and goto. Thinking so, they removed them from the Java language and released the first version JDK 1.0 (in the year 1995). But still they were doubtful whether a language can exist without these two words in future; in the sense, they may be required in future versions. For this reason, const and goto were placed in reserved list. That is, they may be brought back into the Java language anytime in future. Right now as on JDK 1.8, Java proved a language can exist without these two words.

    Ofcourse, const place is taken by final keyword in Java. goto is against to structured programming language where with goto, the Programmer looses control over the flow or the structure of coding.

  3. Literals: The literals also cannot be used as identifiers but can be given as values to identifiers (like boolean b1 = true).

Some people use keyword and reserved word interchangeably treating as one and the same. It may be true in other languages but in Java, both are very different.

Leave a Reply

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