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

Can we make the abstract methods static in java?

601


What kind of variables can a class consist?

602


What is a subsequence of a string?

556


What is the order of arraylist in java?

621


What is main in java?

521






What restrictions are placed on method overloading?

618


What are the different data types in java?

538


Why is sizeof not a function?

559


Can java program run without jre?

579


Explain about oops concepts.

641


What is type parameter in java?

531


What is double data type?

541


How many types of variables are there?

685


Why do we use string?

581


What does file separator do in java?

547