title: What is the output if subclasss does not override to string overrided by superclass?
body: <p><strong><code>In which of the following case i get output "Hello World" ?</code></strong></p>
  
  <pre><code>class A{
  
  @Override
  public String toString() {
      return "Hello World";
  }
  
  }
  
  public class B extends A{
  
  public void print(){
          //replace code that displays "Hello World"
      }
  
      public static void main(String args[]){
          new B().print();
      }
  
  }
  </code></pre>
  
  <p><strong>I.  System.out.println(new A());</strong></p>
  
  <p><strong>II. System.out.println(new B());</strong></p>
  
  <p><strong>III.System.out.println(this);</strong></p>
  
  <pre><code>1. only I
  2. I and III
  3. I and II
  4. all I,II and III
  </code></pre>
  
  <p>its <code>answer is 4</code> i.e. <code>all I,II and III</code> </p>
  
  <p><em><code>i understood about I but why II and III is also right ?</code></em></p>
  
  <p><strong><code>EDIT : Also specify which section of jls provides this specification ?</code></strong></p>