JAVA Programming :: Inheritance - Discussion
Home > JAVA Programming > Inheritance > MCQs Questions Discussion
8 / 9
What will be the result of compiling the following code:
public class SuperClass {
public int doIt(String str, Integer... datthrows Exception{
String signature = "(String, Integer[])";
System.out.println(str + " " + signature);
return 1;
}
}
public class SubClass extends SuperClass{
public int doIt(String str, Integer... dat
{
String signature = "(String, Integer[])";
System.out.println("Overridden: " + str + " " +
signature);
return 0;
}
public static void main(String... args)
{
SuperClass sb = new SubClass();
sb.doIt("hello", ;
}
}
public class SuperClass {
public int doIt(String str, Integer... datthrows Exception{
String signature = "(String, Integer[])";
System.out.println(str + " " + signature);
return 1;
}
}
public class SubClass extends SuperClass{
public int doIt(String str, Integer... dat
{
String signature = "(String, Integer[])";
System.out.println("Overridden: " + str + " " +
signature);
return 0;
}
public static void main(String... args)
{
SuperClass sb = new SubClass();
sb.doIt("hello", ;
}
}
AOverridden: hello (String, Integer[])
Bhello (String, Integer[])
CComplilation fails
DNone of the above
Answer: Option (Login/Signup)
Show Explanation
Asked In ::
No Discussion on this question yet!