Search This Blog

Thursday, April 24, 2025

Interesting facts about JAVA - 3

 const is a Java reserved word with no assigned semantics to it. So, you cannot create an identifier with the name const. It is not a keyword, so it cannot be used in a Java program. It is just a prohibited word. A word that has no meaning in Java but is forbidden for any kind of use. Funny, isn't it?

If you declare to as a local variable:


On compilation, you get an error:


If you declare it as an instance variable:


On compilation, you get the following error:



By: Nancy K A N

@9:48 25-Apr-2025





No comments:

Post a Comment