title: Two java files. Getting IllegalAccessError when running class with main method trying to access a method from the other file
body: <p>Learning Java. I have two files, each containing one java class. When I run the file with the main method, I get the following error: </p>
  
  <p><strong><em>Exception in thread "main" java.lang.IllegalAccessError: failed to access class TapeDeck from class TapeDeckTestDrive (TapeDeck is in unnamed module of loader 'app'; TapeDeckTestDrive is in unnamed module of loader com.sun.tools.javac.launcher.Main$MemoryClassLoader @18bf3d14)
          at TapeDeckTestDrive.main(TapeDeckTestDrive.java:3)</em></strong></p>
  
  <pre><code>class TapeDeckTestDrive{
    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>
  
  <p>Any help please?</p>