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
Can we make the abstract methods static in java?
What kind of variables can a class consist?
What is a subsequence of a string?
What is the order of arraylist in java?
What is main in java?
What restrictions are placed on method overloading?
What are the different data types in java?
Why is sizeof not a function?
Can java program run without jre?
Explain about oops concepts.
What is type parameter in java?
What is double data type?
How many types of variables are there?
Why do we use string?
What does file separator do in java?