How to Call a Java Method?

Create an instance of the class if the method is non-static

Call the method using the object reference and dot notation

Use the class name and dot notation if the method is static

Pass any required arguments inside parentheses

Store the return value in a variable if the method returns a value

Use the method name exactly as declared, including case

Ensure the method is accessible from the calling code

Suggested for You

Trending Today