title: Needing help understanding piece of Java code
body: <p>I started learn Java today, following by Head First Java, 2nd Edition, and I have some code, which is confusing to me. I've got experience in Python, but this is new. To be more specific, I don't understand what <strong>boolean canRecord = false;</strong>
  actually do.</p>
  
  <pre><code>class DVDPlayer {
  
      boolean canRecord = false;
  
      void recordDVD() {
          System.out.println("DVD recording");
      }
      void playDVD() {
         System.out.println("DVD playing");
     }    
  } 
  
  class DVDPlayerTestDrive {
      public static void main(String [] args) {
  
          DVDPlayer d = new DVDPlayer();
          d.canRecord = true;
          d.playDVD();
  
          if (d.canRecord == true) {
              d.recordDVD();
          }
      }
  }   
  </code></pre>