title: How does Main have access to class?
body: <p>I'm new to coding and I made this program that allows someone to input the song name, artist, album, year released and I just print it out. So while I CAN write the program, I don't understand how main gains access to the the CD class. How did the computer know I was creating a CD from this other class I had? Why was I able to use the accessor methods from the CD class? Sorry if this sounds dumb but I'm trying to understand why it works! THANK YOU FOR ANSWERS.</p>
  
  <p>Thank you to all who answered! It makes sense now!</p>
  
  <pre><code>package project1;
  
  public class CD {
      private String song;
      private String artist;
      private String album;
      private int year;
  
      public CD(String givenSong, String givenArtist, String givenAlbum, int givenYear)
      {
          song=givenSong;
          artist=givenArtist;
          album=givenAlbum;
          year=givenYear;
      }
      public String getSong(){
          return song;
      }
      public int getYear(){
          return year;
      }
      public String getArtist(){
          return artist;
      }
      public String getAlbum(){
          return album;
      }
  }
  </code></pre>
  
  <p>and main..</p>
  
  <pre><code>package project1;
  
  public class CDTest {
      public static void main(String[] args){
          CD cd1= new CD("Sad machine","Porter Robinson","Worlds",2014);
          System.out.print(cd1.getSong()+", ");
          System.out.print(cd1.getArtist()+", ");
          System.out.print(cd1.getAlbum()+", ");
          System.out.print(cd1.getYear());
      }
  
  }
  </code></pre>