Declare a method
To declare a method in Java use:
visibility returnType methodName(type name1, type name2, ...) {
// code for method
}
or
visibility returnType methodName(type name1, type name2, ...)
{
// code for method
}
Where visibility is usually public or private and the returnType is
the type of thing returned from the method (or null) if nothing is returned.
Example:
public String getName() { return this.name; }
Link to this Page
- Declarations last edited on 21 March 2005 at 3:46 pm by user-11210m8.dsl.mindspring.com