title: Does a class gets loaded in memory when a static variable is accessed in java?
body: <p>I have a class:</p>
  
  <pre><code>public class Foo {
      public static boolean flag = false;
      //some code
  }
  </code></pre>
  
  <p>I am using this <code>boolean</code> flag in another class:</p>
  
  <pre><code>public class FooImpl{
      public static void main (String args[]) {
          if (Foo.flag){
              //Line 1
              //some code
          }
      }
  }
  </code></pre>
  
  <p>So at <code>Line 1</code>, does class <code>Foo</code> gets fully loaded in the memory or just the static variable gets loaded with default value? </p>