© Kishori Sharan 2017

Kishori Sharan, Beginning Java 9 Fundamentals, https://doi.org/10.1007/978-1-4842-2902-6_8

8. Methods

Kishori Sharan

(1)Montgomery, Alabama, USA

In this chapter, you will learn:

  • What methods are and how to declare methods in a class

  • The meaning of the pronouns this and super 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 then, the 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 a class defines a behavior of ...

Get Beginning Java 9 Fundamentals: Arrays, Objects, Modules, JShell, and Regular Expressions 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.