A

Admin • 833K Points
Coach

Q. What will be the result after compiling this code?
class SuperClass{
public int doIt(String str, Integer... data)throws Exception{
String signature = "(String, Integer[])";
System.out.println(str + " " + signature);
return 1;
}
}

public class Test extends SuperClass{
public int doIt(String str, Integer... data){
String signature = "(String, Integer[])";
System.out.println("Overridden: " + str + " " +signature);
return 0;
}

public static void main(String... args){
SuperClass sb = new Test();
sb.doIt("hello", 3);
}
}

  • (A) Overridden: hello (String, Integer[])
  • (B) hello (String, Integer[])
  • (C) Compilation fails
  • (D) None of these
  • Correct Answer - Option(C)
  • Views: 17
  • Filed under category Java
  • Hashtags:

Explanation by: Admin

Exception must be caught or declared to be thrown.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.