title: Java - Why does child does no inherit of parents variables?
body: <p>Why do I get 0 instead of 1500 when I run this code ?</p>
  
  <pre><code>public class Department {
      private double rate = 0.0;
  
      public Department {
      }
  
      public getRate(){
          return rate;
      }
  
      public setRate(){
          rate = 1 + 2;
      }
  }
  
  public class Employe extends Department {
  
      private double salary = 0;
  
      public Employe {
      }
  
      public calculateSalary(){
            salary = getRate() * 500;
      }
  }
  
  public static void main(String[] args) throws IOException {
  
      Department department = New Department();
      department.setRate();
  
      Employe employe = new Employe();
      System.out.println(employe.calculateSalary());
  }
  </code></pre>