Answer:
No—this is not allowed and the dot notation does not even give you a way to ask for it.
Method Definition
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:
- Accept a deposit
- Process a check
- Get the current balance
Remember the syntax for method definition:
returnType methodName ( parameterList )
{
statementList
}
The first line in the above is called the signature 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 the two parentheses must be there).
QUESTION 10:
(Review: ) What is returnType when a method does not return a value?