Java: Method parameters or arguments

The parentheses that follow the method name are used to pass arguments to the method.

A method can be defined to take any number of arguments and they can have any data types, just ensure the method is called with the same types and number of arguments.

package javaapplication17;

public class JavaApplication17 {

    static class MyApp {

        void PrintOut(String s) {
            System.out.println(s);
        }
    }

    public static void main(String[] args) {
        MyApp m = new MyApp();
        m.PrintOut("Hello");
    }
}

argument

Series Navigation<< Java: Calling methods
Java: Return statement >>