Java-Method Returns

Method Returns A method may be instructed to return a value after its execution is over. A special statement namely the return shall be used for this purpose. Program After a1.areaVolume( ) executes, the value of a1.areaVolume( ) is 187500. There are two important things to understand about returning values: 1. The type of data returned by … Read more…

Java-Return

Return The return statement is used to explicitly return from a method. The return statement immediately terminates the method in which it is executed. For example: As you can see, the final println( ) statement is not executed. As soon as return is executed, control passes back to the caller. Program Program Source class Javaapp { … Read more…