title: Do static variables and methods belong to java.lang.Class object of that class?
body: <p>I have read lot of questions on this topic and many of them say the static content (<code>static methods</code> and <code>variables</code>) belongs to <code>java.lang.Class</code> object (also known as class level object which lives in Permanent Generation) and the reasons behind this are</p>
  
  <ol>
  <li>In Java specification, we can found this "static content belongs to some internal structure of the class which is common to all objects and exist outside of the objects".</li>
  </ol>
  
  <p>As mentioned in §8.3.1.1 of Java Language Specification </p>
  
  <blockquote>
    <p>If a field is declared static, there exists exactly one incarnation of
    the field, no matter how many instances (possibly zero) of the class
    may eventually be created. A static field, sometimes called a class
    variable, is incarnated when the class is initialized (§12.4).</p>
  </blockquote>
  
  <ol start="2">
  <li><p><code>java.lang.Class</code> object of a class represents the internal structure of the class, there exists exactly one incarnation of it and it is common to all objects.</p></li>
  <li><p><code>java.lang.Class</code> object gets created in Perm Gen when the class is loaded and initialized.</p></li>
  <li><p><code>java.lang.Class</code> is known as the class level object and static variables are called class variable because static variables lie as the state of the class level object.</p></li>
  <li><p>While synchronizing a static method we need to get the lock on the class level object which is again <code>java.lang.Class</code> instance.</p></li>
  </ol>
  
  <p>As mentioned in §8.4.3.6 says:</p>
  
  <blockquote>
    <p>For a class (static) method, the monitor associated with the Class
    object for the method's class is used.</p>
  </blockquote>
  
  <p>From above points, we can conclude that static content belongs to <code>java.lang.Class</code> instance but why is it not written clearly anywhere in any specification?</p>
  
  <p>And also if <code>class A { static int b; }</code> why is <code>b</code> is not accessible via <code>A.class.b</code>?</p>
  
  <p>So how would you prove that the static variables and methods belong to the <code>Class</code> object?</p>
  
  <p>And if the static content doesn't belong to the Class object, then where exactly does it belong? and why do lots of answers, blogs and tutorials mention it?</p>