Hi all, Just a question regarding integral literals. The Java language specification says that all integral literals are 32 bit values. To indicate a long(64 bit) literal append the suffix L to the literal expression. Right now i cant see the purpose of this (im sure that theres a really obvious reason that ill just kick myself when i hear). If a integral literal is assigned to a long variable then is this literal not upcast automatically to a long. So why do you need to indicate to the VM using L that the literal is to be a long?? thanks, john
The main reason I can think of is for readability. It indicates that you know what you are talking about. However, I don't ever use this convention. It DOES seem a bit redundant, doesn't it? The only other thing that comes to mind is that perhaps the compiler can do some kind of optimization if you indicate that the literal is really a long.