what is the reason behind non static method cannot be
referenced from a static Context?

Answers were Sorted based on User's Feedback



what is the reason behind non static method cannot be referenced from a static Context?..

Answer / 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

what is the reason behind non static method cannot be referenced from a static Context?..

Answer / sadikhasan palsaniya

static variable and method refer to the class variable and
method and non static method can refer to particular object
and if static method can permit to access non static method
then how can recognize that method belong which object
that's why not accessible.

if any mistake welcome and correct me!!!!!

Is This Answer Correct ?    3 Yes 1 No

Post New Answer

More Core Java Interview Questions

What are the different conditional statements?

0 Answers  


What is the difference between member variables initialization and assignment in a constructor?

0 Answers   Hexaware, Virtusa,


what is the output??????? public class multireturn { public(int assign x ( int x) { if(4==x) { return 7; } else if (7=x+3) { return 6; } return 5; } }

3 Answers   TCS,


Why does java have two ways to create child threads? Which way is better?

0 Answers  


Explain with example the concept of constant variable in java.

0 Answers   HCL,






what is request processor?

1 Answers   Virtusa,


How big is a 32 bit integer?

0 Answers  


What is the difference between the >> and >>> operators?

1 Answers  


How to set the Heap size in Java ?

2 Answers   HCL,


Explain Big-O notation with an example

1 Answers  


What happens when a main method is declared as private?

22 Answers   DELL, Infosys, L&T, Sun Microsystems,


when System.out.println("") is executed what happens in the back ground?

2 Answers  


Categories