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
What is this keyword in java?
take an array with -ve and +ve value both.find out the nearest value of 0(zero).if two values are same like(-2 and +2)then extract +2 is nearest of 0(zero).
What are invisible components?.
What is jit compiler in java?
What is slash r?
What state does a thread enter when it terminates its processing in java programming?
Can an interface have a class?
What languages are pass by reference?
How would you use Bubble Sort to sort the number of elements?
What is the java virtual machine?
Explain about transient variables in java?
What is the purpose of sizeof operator?
What is the difference between stream and buffer?
How can you write a loop indefinitely in java programming?
What is tostring () method?