title: Memory management utilization in java
body: <p>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</p>
  
  <pre><code>class A{
      ......
  }
  </code></pre>
  
  <p>Now from my main function i am creating one object of A.</p>
  
  <pre><code>A obj = new A();
  </code></pre>
  
  <p>now after creating the object i will be able to access any methods,variables present in the class.</p>
  
  <p>But for static methods or variables we can achieve this directly by using class name like</p>
  
  <pre><code>A.methodname();
  </code></pre>
  
  <p>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.</p>