A

Admin • 833K Points
Coach

Q. What is the output of the below Java program trying to overload a method "jump"?

Code:
class Rabbit{ }
class WildRabbit extends Rabbit{ }

public class MethodOverloading4
{
Rabbit jump()
{
System.out.println("Rabbit Jump");
return new Rabbit();
}
WildRabbit jump()
{
System.out.println("Wild Rabbit Jump");
return new WildRabbit();
}

public static void main(String[] args)
{
MethodOverloading4 obj = new MethodOverloading4();
obj.jump();
}
}
  • (A) Rabbit Jump
  • (B) Wild Rabbit Jump
  • (C) Compiler error
  • (D) None
  • Correct Answer - Option(C)
  • Views: 28
  • Filed under category Java
  • Hashtags:

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.