Java Quiz 21

What will be output of this puzzle on constructors ?

 

package quiz;

public class Hi extends Greeting{

  public static void main(String[] args) {

    new Hi();
    new Hi("Hi");
  }
  
  Hi(){this("Hello");}

  Hi(String s){super(s);}
}


 
package quiz;

public class Greeting {

  Greeting(String s){ System.out.print(s);}
}

© 2015 – 2016, https:. All rights reserved. On republishing this post, you must provide link to original post

One comment

  1. Hello

    Hi

Leave a Reply.. code can be added in <code> </code> tags

%d bloggers like this: