Friday 31 January 2014

Textual Representation of logo

What Will be Output Of this Code

This is a very simple question which tests your concepts of overloading and overriding in java .

Class 1 :
package com.test;

public class Super
{
 public void method(Object obj)
 {
     System.out.println("Super one");
 }
}
Class 2 :



package com.test;

public class SubClass extends Super
{
 public void method(String s1)
 {
  System.out.println("Sub class");
 }
}

package com.test;

public class OverrideTest
{
 public static void main(String[] args)
 {
  Super obj = new SubClass();
  obj.method("NJJJ");
 }
}


So , What Will be Output Of this Code ??