title: Class name same as filename in java?
body: <p>in java, filename should be same as that of main class. It is the way of telling compiler that this is the entry point for you. but why this thing works:</p>
  
  <pre><code>class xyz{
  public static void main(String[] args){
  System.out.println("a");
  }
  }
  </code></pre>
  
  <p>even when saved with different filename.</p>
  
  <p>And why this thing does not when saved with diffrent filename: </p>
  
  <pre><code>public class xyz{
  public static void main(String[] args){
  System.out.println("a");
  }
  }
  </code></pre>