Multiple choice

Which of the following is the valid overridden method for public int sum(int a, int b){ }?

  1. public long sum(int a, int b){}

  2. public int sum(int a, int b){}

  3. public void sum(long a, long b){}

  4. public int sum(long a, long b){}

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

For overridden methods, return type and signature should be the same.