Multiple choice technology programming languages

A method is defined in a class as : void processUser(int i) { } If this method is overriden in a sub class,

  1. the new method should return int

  2. the new method can return any type of values

  3. the argument list of new method should exactly match that of overriden method

  4. the return type of new method should exactly match that of overriden method

Reveal answer Fill a bubble to check yourself
C,D Correct answer
Explanation

When overriding a method in Java, the signature (parameter list) must match exactly, and the return type must be the same or a covariant subtype (not changed arbitrarily). Options A and B are incorrect.