Java Return Type
The case where no return is expected.
If no return is expected from the method should be written as a void before the method name. it informs that no return is expected.
thus, since the main method has also been used to write the void, it is felt that no return is expected from the main method.
The case where the return is expected
Here it is essential to specify the data type before the method name instead of void. here, the data type to be returned is determined according to the date type provided. that is, when specified as int, double, char, or String the return is always the same as that data type.
int
double
Comments
Post a Comment