© Kishori Sharan and Adam L. Davis 2022
K. Sharan, A. L. DavisBeginning Java 17 Fundamentalshttps://doi.org/10.1007/978-1-4842-7307-4_8

8. Methods

Kishori Sharan1   and Adam L. Davis2
(1)
Montgomery, AL, USA
(2)
Oviedo, FL, USA
 
In this chapter, you will learn:
  • What methods are and how to declare methods in a class

  • The meaning of the pronoun this in a Java program

  • What local variables are and rules for using them

  • How to invoke methods of a class

  • Different parameter-passing mechanisms in general and parameter-passing mechanisms in Java

  • How to declare and use var-args parameters

Example classes in this chapter are in the com.jdojo.cls package, which is a member of the jdojo.cls module. You created the jdojo.cls module in Chapter 7.

What Is a Method?

A method in ...

Get Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.