title: Two public classes in one file java
body: <p>Ok, this might be kiddies question in java. We can't define two public classes in one file. But, in one of the examples from the book SCJP study guide, this example was mentioned:</p>
  
  <pre><code>public abstract class A{
      public abstract void show(String data);
  }
  
  public class B extends A{
      public void show(String data){
          System.out.println("The string data is "+data);
      }
      public static void main(String [] args){
          B b = new B();
          b.show("Some sample string data");
      }
  }
  </code></pre>
  
  <p>When I copy pasted this into netbeans immediately compile error was thrown, that public class A should me mentioned in separate file. Is that example from SCJP styudy guide really wrong? Also in some of the mock test I found many questions having such pattern but in none of the options was a compiler error was mentioned. Getting worried here</p>