Skip to main content
Module 2 · Lesson 2 of 35/22 in the course~15 min
Module lessons (2/3)

Methods, Pass-by-Value and Overloading

Lesson preview5 hands-on exercises readyCourse Java · Module 2 — Fundamentals of OOP

How Java passes references by value, cohesive method design, constructor delegation this(...) and overloading.

What you'll learn in this lesson

  • Design cohesive methods with clear return types and overloading based solely on the parameter list.
  • Reduce duplication between constructors using this(...) delegation.
  • Demonstrate why Java always passes by value even object references (changing the state vs reassigning the parameter).

Overview

Methods define the actions allowed on an object, while overloading allows you to offer multiple convenient variations of the same name with different parameters.

Each method combines visibility, return type, name, and parameter list. In overloaded constructors you can delegate to the main constructor with this(...) as the very first statement:

Sections covered in this lesson

  1. 11. Anatomy of a Method and Delegation this(...)
  2. 22. Method Overloading
  3. 33. Java is ALWAYS Pass-by-Value (even for Objects!)
  4. 44. Interactive Simulator: Pass-by-Value in Action
  5. 5Try it yourself
Pro Lesson · Module 2 — Fundamentals of OOP

Unlock "Methods, Pass-by-Value and Overloading" and the full Course Java curriculum

How Java passes references by value, cohesive method design, constructor delegation `this(...)` and overloading.

Unlock all 5 hands-on exercises in this lesson plus every advanced WebAssembly module with automated checks.

  • Instant access to all advanced modules in Course Java plus 17 more courses
  • Hands-on browser exercises with automated test suites and solutions
  • 14-day money-back guarantee processed via Paddle.com

14-day guarantee · Cancel anytimeModule 1, all 18 interactive games, and cheatsheets are always free.