title: Can't find main(String[]) method in class: TapeDeck. The main method is in the other class which runs the program
body: <p>I have two classes. When the I put class TapeDeckTestDrive first on the text editor, it runs fine. When I put the TestDrive class first, it gives the error that it can't find the main class. Why is this?</p>
  
  <pre><code>class TapeDeck {
      boolean canRecord = false;
      void playTape(){
          System.out.println("tape playing");
      }
      void recordTape(){
          System.out.println("tape recording");
      }
  }
  
  class TapeDeckcTestDrive{
      public static void main(String[] args){
          TapeDeck t = new TapeDeck();
          t.canRecord = true;
          t.playTape();
  
          if (t.canRecord == true) {
              t.recordTape();
          }
      }
  }
  </code></pre>
  
  <p>ERROR ON THIS FORMAT</p>
  
  <p>VS </p>
  
  <p>FOLLOWING WORKS FINE:</p>
  
  <pre><code>class TapeDeckcTestDrive{
      public static void main(String[] args){
          TapeDeck t = new TapeDeck();
          t.canRecord = true;
          t.playTape();
  
          if (t.canRecord == true) {
              t.recordTape();
          }
      }
  }
  
  class TapeDeck {
      boolean canRecord = false;
      void playTape(){
          System.out.println("tape playing");
      }
      void recordTape(){
          System.out.println("tape recording");
      }
  }
  </code></pre>