🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Java Methods: all 10 questions

Quiz: Java Methods · Question 2 of 10

Which pair is valid overloading?

Which pair is valid overloading?

  1. A.int f(int a) and double f(int a)
  2. B.int f(int a) and int f(int a, int b)
  3. C.void f(int a) and void f(int b)
  4. 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 →