title: Accesing variable from a different class in java
body: <p>Is there a way i can pass a variable from one class with main to another one with main method.
  For example</p>
  
  <pre><code>class A
  {
  
      public static void main(String [] args)
      {
  
           int num = 5;
      }
  }
  
  class B
  {
      public static void main(String []args)
      {
      }
  }
  </code></pre>
  
  <p>Is there a way Class B can access int num from class A without getting null value?</p>