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:
If you declare it as an instance variable:
On compilation, you get the following error:
No comments:
Post a Comment