title: Inheritance instance variables with Java
body: <p>I am aware that if you subclass a class (superclass) which has for example an instance variable, it is going to be inherited in the subclass.</p>
  
  <p>i.e. :</p>
  
  <pre><code>class Weather {
      int humidity;
  }
  
  public class Rainy extends Weather {
      void changeHumidity() {
          humidity = 10;
          System.out.println(super.humidity);
      }
  
      public static void main(String[] args) {
          new Rainy().changeHumidity();
      }
  }
  </code></pre>
  
  <p>Bottom line: I would like to know why the instance variable "humidity" gets shared between subclass and class.</p>
  
  <p>I am aware that if I shadowed that, it would not be shared but still why another instance (even though is the superclass) should share a variable with the subclass in the inheritance logic.</p>
  
  <p>Thanks in advance.</p>