Two Laptop Bag*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Interface Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Interface Question" Watch "Interface Question" New topic
Author

Interface Question

Swapan Mazumdar
Ranch Hand

Joined: Jul 23, 2003
Posts: 83
Please look at the code below:


Why the non-static method . can access public final static class variable LOW_GRAVITY? I understand that "you can't access non-static variable from a static method" but this scenario seems to be just opposite of the concept.
Why am I confused? I need some help
David Ulicny
Ranch Hand

Joined: Aug 04, 2004
Posts: 724
It is final and static. It cannot change the value and is accessible from everywhere everytime.


SCJP<br />SCWCD <br />ICSD(286)<br />MCP 70-216
Ikram Soomro
Ranch Hand

Joined: Oct 20, 2001
Posts: 42
But you can access static resources anywhere in program (i.e. static and non static methods) as they belong to class.
Swapan Mazumdar
Ranch Hand

Joined: Jul 23, 2003
Posts: 83
Thanks David and Ikram...

I think I was a bit little more stressed out
 
GeeCON Prague 2014
 
subject: Interface Question