← Quiz: Java Methods: all 10 questions
Quiz: Java Methods · Question 2 of 10
Which pair is valid overloading?
Which pair is valid overloading?
- A.int f(int a) and double f(int a)
- B.int f(int a) and int f(int a, int b)
- C.void f(int a) and void f(int b)
- D.int f(int a) and int F(int a)
Answer & explanation
Correct answer: int f(int a) and int f(int a, int b)
Overloading needs different parameter lists. Return type alone (or parameter names) doesn't count; F is just a different method.
Can you get the rest right without peeking?
Take the timed Quiz: Java Methods quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →