For more information about how to call methods see Using an Object . In Java, you define a class's methods within the body of the class for which the method implements some behaviour. Typically, you declare a class's methods after its variables in the class body although this is not required. The Method Declaration At minimum, the method declaration component of a method implementation has a return type indicating the data type of the value returned by the method, and a name. The method declaration shown above is very basic.
Methods have many other attributes such as arguments, access control, and so on.
This section will cover these topics as well as expand upon the features illustrated in the method declarations above. The this keyword and other method body features are covered in this section.