aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Manifest Constants Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Manifest Constants" Watch "Manifest Constants" New topic
Author

Manifest Constants

Philani Dlamini
Greenhorn

Joined: Apr 07, 2005
Posts: 23
I know that (K&B book) on the exam we wont be asked to make esoteric dinstictions between keywords and manifest consants: null,true & false.
i assumed the JVM identifies keywords by boldfacing them(if theres such a thing) and this is what happens with manifest constans as well.
why not just make them keywords, anyone with a clue?
Serge Plourde
Ranch Hand

Joined: Jun 23, 2000
Posts: 140
I know that (K&B book) on the exam we wont be asked to make esoteric dinstictions between keywords and manifest consants: null,true & false.
i assumed the JVM identifies keywords by boldfacing them(if theres such a thing) and this is what happens with manifest constans as well.
why not just make them keywords, anyone with a clue?


I don't think it is the JVM that handles this but rather the compiler.

null, true and false are not constants but literals of the boolean type and the null type, as stated below.

The keywords help the compiler to parse the code with the different elements of the language, and the literals are used to assign values. So, I don't think that you can mix those two different things up.

From the JLS (Java Language Specirication, 3rd ed):

3.9 Keywords
The following character sequences, formed from ASCII letters, are reserved for use as keywords and cannot be used as identifiers (�3.8)... While true and false might appear to be keywords, they are technically Boolean literals (�3.10.3). Similarly, while null might appear to be a keyword, it
is technically the null literal (�3.10.7).


... then
a literal is the source code representation of a value of a primitive type, the String type, or the null type.


You can read the JLS, especially chapter 3: Lexical Structure. I think it helps in understanding that.
Philani Dlamini
Greenhorn

Joined: Apr 07, 2005
Posts: 23
3.9 Keywords
The following character sequences, formed from ASCII letters, are reserved for use as keywords and cannot be used as identifiers (�3.8)... While true and false might appear to be keywords, they are technically Boolean literals (�3.10.3). Similarly, while null might appear to be a keyword, it
is technically the null literal (�3.10.7).

The above helps solidify my understanding, thank you very much.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Manifest Constants