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


Please Help Members By Posting Answers For Below Questions

What are the common uses of "this" keyword in java ?

800


How do I write a self declaration?

780


What is the difference between the file and randomaccessfile classes?

828


What environment variables do I need to set on my machine in order to be able to run java programs?

810


What is the mapping mechanism used by java to identify IDL language?

813


What are the advantages and disadvantages of object cloning?

806


Is array serializable java?

740


What is the function of http?

787


Is there any limitation of using inheritance?

825


What is a qms manual?

774


What is the difference between heap memory and stack memory?

847


What is the use of toarray () in java?

807


Is a char always 1 byte?

745


How many digits can a float hold?

770


When can we say that threads are not lightweight process in java?

859