title: Java Inheritance, Constructor and "super"
body: <p>Hello everyone I recently started learning OOP in Java and I just have a few questions, I'll use my (probably poorly written) code to demonstrate.</p>
  <p>Let me introduce my superclass first, Vehicle:</p>
  <pre><code>public class Vehicle {
      private String description;
      private double speed;
      private double tankLevel;
  
      public Vehicle(String description, double speed, double tankLevel) {
          this.description = description;
          this.speed = speed;
          this.tankLevel = tankLevel;
      }
  
      public Vehicle() {
  
      }
  
      public Vehicle(String description, double speed) {
          this.description = description;
          this.speed = speed;
      }
  
      public void drive() {
          if(getTankLevel() != 0) {
              if(getSpeed() != 0) {
                  System.out.println(&quot;Your &quot; + getDescription() + &quot; is driving&quot;);
              }
              else {
                  System.out.println(&quot;You have enough fuel but your &quot;+ getDescription() +&quot; isn't running&quot;);
              }
          }
          else {
              System.out.println(&quot;Tanklevel too low!&quot;);
          }
      }
  
      public double getTankLevel() {
          return tankLevel;
      }
  
      public double getSpeed() {
          return speed;
      }
  
      public String getDescription() {
          return description;
      }
  }
  
  </code></pre>
  <p>Now here is the subclass, VehicleMain, where my first question comes up:</p>
  <pre><code>public class VehicleMain extends Vehicle {
  
      public VehicleMain(String description, double speed, double tankLevel) {
          super(description, speed, tankLevel);
      }
  
      public static void main(String[] args) {
          
          Vehicle car = new Vehicle(&quot;car&quot;, 20, 5);
          
          car.drive();
  
      }
  }
  </code></pre>
  <ol>
  <li>question: Is there a good way to explain why I need that constructor in VehicleMain?</li>
  <li>question: Why do I use super() in the constructor?</li>
  <li>question: In method drive() in my superclass, should I use the private String description, or the method getDescription() ?</li>
  </ol>
  <p>Thanks for any help in advance!</p>