No—this is not allowed and the dot notation does not even give you a way to ask for it.
Now that we have a test program, we can add methods to the class one-by-one, testing each method as it is added. Recall the three methods from the requirements:
Remember the syntax for method definition:
returnType methodName ( parameterList ) { statementList }
The first line in the above is called the header of a method
definition.
It does not have to be all on one line.
The returnType
is the data type that the method returns.
It will be one of the primitive data types, or a class.
The methodName
is an identifier picked by the programmer.
It can be any identifier except for reserved words or identifiers already in use.
The parameterList
is a list of parameters and their data types.
If there are no parameters, the parameter list is omitted,
(but not the two parentheses.)
(Review: ) What is returnType when a method does not return a value?