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 are the common uses of "this" keyword in java ?
How do I write a self declaration?
What is the difference between the file and randomaccessfile classes?
What environment variables do I need to set on my machine in order to be able to run java programs?
What is the mapping mechanism used by java to identify IDL language?
What are the advantages and disadvantages of object cloning?
Is array serializable java?
What is the function of http?
Is there any limitation of using inheritance?
What is a qms manual?
What is the difference between heap memory and stack memory?
What is the use of toarray () in java?
Is a char always 1 byte?
How many digits can a float hold?
When can we say that threads are not lightweight process in java?