what is the reason behind non static method cannot be
referenced from a static Context?
Answers were Sorted based on User's Feedback
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 |
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 |
What happens when a thrown exception is not handled?
What is flag in python?
Write a program in java to calculate the difference between the sum of the odd level and even level nodes of a binary tree.
Why can't you declare a class as protected?
Does constructor return any value?
What is the relationship difference the canvas class and the graphics class?
What are decalarations?
what is the difference b/w PUT and POST method to send data to the server
is JVM platform dependent or independent..?
11 Answers IBM, Tech Mahindra,
What is lazy activation?
What are recursive functions? Give some examples?
0 Answers Axtria, ITC Indian Tobacco Company,
What is difference between string and new string?