title: Static variable out of scope, Error: cannot find symbol
body: <p>the Error is:</p>
  
  <blockquote>
    <p>cannot find symbol <code>System.out.println("value of count" + count);</code></p>
  </blockquote>
  
  <p>Symbol:</p>
  
  <blockquote>
    <p>variable count </p>
  </blockquote>
  
  <p>Location:</p>
  
  <blockquote>
    <p>class synchronize</p>
  </blockquote>
  
  <p>I declared <code>count</code> variable <code>static</code> so doesn't that mean every class can access it?</p>
  
  <pre><code>class a extends Thread 
  
  {
  
  public static int count=0;
  
  public void run()
  
   {
  
     for(int i=1;i&lt;=100;i++){
  
     count++;
      }
    }
  }
  
  class b extends Thread {
  
  public void run(){
  
    for(int i=1;i&lt;=100;i++){
  
    count++;
    }
   }
  }
  
  class synchronize {
  
  public static void main(String args[]) {
  
    a obj =new a();
  
    b obj1=new b();
  
    obj.start();
  
    obj1.start();
  
    System.out.println("value of count "+count) ;
  
   }
  }
  </code></pre>