what is the reason behind non static method cannot be
referenced from a static Context?
Answer Posted / srinivaskumar.nimmana
static method or static variable has special memory called context of class. it is allocate before execution. but in case of non-static method memory allocate at the time of executing.
so clearly static method is first loaded at the time of static method loading non-static method is not available to the static method because it is not loaded.
when non-static is loaded at that time static is already loaded.so static method is always available to non-static vice versa not possible
| Is This Answer Correct ? | 9 Yes | 0 No |
Post New Answer View All Answers
In how many ways we can do exception handling in java?
How do I enable java in safari?
Can we call the run() method instead of start()?
How will you print number in reverse (descending) order in BST.
When should a function throw an exception?
How are multiple inheritances done in Java?
What is complexity in java?
What is the use of parse function in java?
What is keyword in oop?
What is map in java?
Is a method a function?
What is difference between hashset and hashmap in java?
How do you know if a value is nan?
Is java free for commercial?
When wait(), notify(), notifyall() methods are called does it releases the lock or holds the acquired lock?