<p>The <em>base class</em>, <em>super class</em>, or <em>parent class</em> is the initial class that we are working with. Let's say that you want to <em>extend</em> the class, or add additional functionality. The class that inherits from the parent class is called the <em>child class</em>, <em>subclass</em> or <em>derived class</em>.</p>
<h2>Child Class Syntax</h2>
<pre><codeclass="language-java">public class Truck extends Car {
// Truck Appropriate Fields
// Necessary methods for truck
}</code></pre>
<p>This code adds all the methods from Car into the Truck class. You can then add methods that is specific to a Truck into the Truck class.</p>
<p>A child class has all parent fields and access to all parent methods!</p>
<h2>Visibility Modifiers</h2>
<p>Recall the words <code>public</code> and <code>private</code></p>
<p>The <code>public</code> modifier makes the field/method accessible by any class</p>
<p>The <code>private</code> modifier makes the field/method only accessible within the method itself</p>
<p>The protected modifier makes the field/method accessible within the same class or any subclasses.</p>
<h2>Overriding a Method</h2>
<p>You can override a parent class method by declaring a method in the child class with the same...</p>
<ul>
<li>name</li>
<li>number of paramters</li>
<li>parameter types</li>
</ul>
<p>but this method would have different behavior!</p>