Harshit Sethi wrote:
whats the error in this code?
Harshit Sethi wrote:But this is not an instance method it is static method( main),so its scope will be as long as the class is loaded.
Harshit Sethi wrote:And it can also be accessed by class name .I have checked that.so whats the problem.See this code it runs fine.
Harshit Sethi wrote:
So does that mean we can not define anything static within a static method/instance method and static variables and methods are meant to be declared at class level only.Is my interpretation correct?
|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
Harshit Sethi wrote:I think final modifier is must for constants,because the values of constants can't be changed.
Henry Wong wrote:
...the constant may actually change, and isn't really completely constant (hence, remove the final).
|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
Harshit Sethi wrote:
So does that mean we can not define anything static within a static method/instance method and static variables and methods are meant to be declared at class level only.Is my interpretation correct?
http://plainoldjavaobject.blogspot.in
the constant may actually change, and isn't really completely constant (hence, remove the final).
...the constant may actually change, and isn't really completely constant (hence, remove the final).
But Constants are always constants,their value does not change
SCJP 6, OCMJD 6, OCPJWSD 6
I no good English.
Harshit Sethi wrote:
But Constants are always constants,their value does not change .You are mixing constants and variables together.
If what you are saying that constant changes if final is removed then it does not remain a constant it becomes a variable and i am talking about Constants in this post so ,that's not so obvious my friend.
Let's go to the waterfront with this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|