I am having a simple query.Basically its a theoritical question.I need to clear this idea.I have not found any suitable answer to it.The question is very simple.Suppose we have a class named as A
class A{
......
}
Now from my main function i am creating one object of A.
A obj = new A();
now after creating the object i will be able to access any methods,variables present in the class.
But for static methods or variables we can achieve this directly by using class name like
A.methodname();
now my question is if we are creating one object of any class then memory will be allocated for this.Now if we are using static methods are directly calling them via class name then we are not creating any objects,so in that case memory should not be allocated.But without allocating the memory how does we access the methods or any variable name?Using reference also require some memory allocation.so please explain how in this case memory allocation is happening or how we are accessing the methods or variables in the class.