Originally posted by megha joshi:
Sorry I am still not clear...
Does it mean that ...
1) Constants are not given default values by compiler.
2) Constants can't be initialized in constructors.
Thanks,
Megha
Megha, see my edited post above, where I have added some code
to probe to these facts.
1- You know constants =(static+final)
2- Compiler never assigns default values to them, you have to
explicitly assign them when declared or in static block.
3- Only final is not meant constant.
4- One more thing, final or static final is also known as "blank final";
5-final (saying only final) must be initialized before constructor completes (means either in the block codes that executes before constructor or in the constructor itself).
Thanks,
cmbhatt
[ April 28, 2007: Message edited by: Chandra Bhatt ]