Java Method Overloading and Varargs Rules (1Z0-831)
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.
- Java SE 25 Developer Professional (1Z0-831) exam page and topics — Oracle University
Sign up free to mark lessons complete, bookmark topics and track your exam readiness.