title: Abstract classes and methods in Java, Inheritance
body: <p>I have class B, which inherits from class A. The superclass A is abstract, containing one abstract method. I don't want to implement the abstract method in class B, therefore I need to declare class B as abstract as well. Declaring class B abstract, two things are working for me (the programs compile and run correctly):</p>
  
  <p>1.) I don't declare any abstract methods in class B, even thought the class is abstract. This works, I assume, because the class inherits the abstract method of class A, and this is enough for the class to be declared as abstract: we don't need any other abstract methods directly declared in the class.</p>
  
  <p>2.) I do declare the same abstract method in class B as it is declared in class A. This is some kind of overriding (?), not in the same sense as overriding in java (using the same header, but providing different implementation), here I just use again the same header of the method.</p>
  
  <p>Both things are working, and I am not sure whether they are both Ok, and whether some of them is preferred (more correct) that the other. Are the two ways the same (do they mean the same to Java)? </p>
  
  <p>Here I give some example classes, so that what I mean is more clear for you:</p>
  
  <p>Case 1.):</p>
  
  <pre><code>public abstract class A {
      public abstract String giveSum();
  }
  
  public abstract class B extends A {
  
  }
  </code></pre>
  
  <p>Case 2.):</p>
  
  <pre><code>public abstract class A {
      public abstract String giveSum();
  }
  
  public abstract class B extends A {
      public abstract String giveSum();
  }
  </code></pre>
  
  <p>Regards</p>