...

/

Methods in Java

Methods in Java

In this lesson, the basics of Methods in Java are explained.

We'll cover the following...

Methods are how we communicate with objects in Java. We invoke or call a method, i.e.; we are asking the object to carry out a task through the method. Hence, a method is a mechanism that allows us to implement functionality or attribute behavior to objects. Methods follow a particular syntax, as shown in the snippet below.

Press + to interact
ClassOne{
visibility ReturnType Methodname(parameter_one, parameter_two){
//method body
return returnVariable;
}
}

Understanding syntax

Visibility ...