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

describe synchronization in respect to multithreading? : Java thread

513


Can you give few examples of final classes defined in java api?

569


What is the difference between procedural and object-oriented programs?

530


How would you format a date in java? I.e. In the ddmmyyy format?

785


Does apple use java?

501






What is the difference between java applets and applications?

572


What is math floor in java?

477


What is the longest unicode character?

697


What is the base class of all exception classes in java?

572


What is a method in java?

562


Does substring start with 0?

562


Can we modify the throws clause of the superclass method while overriding it in the subclass?

553


What is meant by memory leak?

544


What is a double?

593


What is static import in java?

536