title: Java overloading vs overriding
body: <p>Hi I just want to make sure I have these concepts right.  Overloading in java means that you can have a constructor or a method with different number of arguments or different data types. i.e</p>
  
  <pre><code>public void setValue(){
     this.value = 0;
  }
  public void setValue(int v){
     this.value = v;
  }
  </code></pre>
  
  <p>How about this method? Would it still be considered overloading since it's returning a different data type?</p>
  
  <pre><code>public int setValue(){
     return this.value;
  }
  </code></pre>
  
  <hr>
  
  <p>Second question is: what is overriding
   in java? Does it relate to inheritance. Let's I have the following:</p>
  
  <pre><code>public class Vehicle{
    double basePrice = 20000;
    //constructor defined
    public double getPrice(){
       return basePrice;
     }
  }
  
  public class Truck extends Vehicle{
    double truckPrice = 14000;
    //constructor defined
    public double getPrice(){
       return truckPrice;
     }
  }
  </code></pre>
  
  <p>So now let's say I have the following</p>
  
  <pre><code>Truck truck = new Truck();
  </code></pre>
  
  <p>if I call </p>
  
  <pre><code>truck.super.getPrice()
  </code></pre>
  
  <p>this would return the price from the Vehicle class, 20,000</p>
  
  <p>if I call</p>
  
  <pre><code>truck.getPrice()
  </code></pre>
  
  <p>this would return the price in the truck class, 14,000</p>
  
  <p><strong>Is my knowledge correct for both questions?</strong></p>