static
] [type] name(
[parameters] ) {
body }
access | If no scope is given, a method has package scope.
Other comon values for scope are public (everyone can see it) and
private (can only be seen from within this class).
For small programs don't worry about scope.
However, for applets you need to declare init()
and paintComponent() methods to be public so that the
browser and Java GUI code can see them. If you are writing
an application, you must declare main(...) to be public
so the operating system can call it. |
static |
The static keyword is used to declare class methods -- methods
that don't refer to a specific object. The only method that you will probably
declare this way is main . |
type | Any Java type, including arrays, can be written here to
tell what data type value the method returns. Use void
if the method doesn't return a value. |
Actual parameters or arguments are the values that are written in the method call. The actual parameter values are copied into the formal parameters, which are then like initilialized local variables.