title: Why can't two public classes be defined in one file in java?
body: <p>Why Class B can't become public? 
  How can I use class be in other classes? Is it better to define it inside Cons?!</p>
  
  <pre><code>   //    public class B { why not?
  
     class B {
          int x;  
          B (int n) {
              x=n;
              System.out.println("constructor 'B (int n)' called!");
          }
      }
  
      public class Cons { 
          public static void main(String[] args) {B b = new B();}
      }
  </code></pre>