SaveMyCert
Log in
2 of 2 free questions left today·for 5 a day
Applying Object-Oriented Principles in Java Programs

Java Method Overloading and Varargs Rules (1Z0-831)

17 min read1Z0-831 · Applying Object-Oriented Principles in Java ProgramsUpdated

Method overloading in Java means declaring several methods with the same name but different parameter type lists, and letting the compiler choose one for each call from the declared types of its arguments; a var-arg (variable-arity) method is one whose last parameter, written Type..., accepts any number of arguments as an array. Oracle 1Z0-831 objective 3.3 asks you to implement both, which in practice means predicting which overload a call binds to, whether it compiles at all, and what array a var-arg method receives. This lesson covers what makes a legal overload, the compiler's three resolution phases (widening, then boxing, then varargs), the most-specific rule and ambiguity, var-arg declaration and call rules, and why overloads are chosen at compile time while overrides are chosen at run time.

You’ve read your 2 free 1Z0-831 lessons

Sign up free to read 48 more lessons — your progress is saved.

Source

This lesson covers the "Applying Object-Oriented Principles in Java Programs" domain of the official 1Z0-831 exam guide. Vendors revise their guides — check the source for the current version.

Sign up free to mark lessons complete, bookmark topics and track your exam readiness.

Spotted a mistake in this lesson?