This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
hai steve, actually i am not getting what r u talking abt. This statement --------------- stmt1: vol = mybox2.volume(); stmt:2 System.out.println("Volume is " + vol); } // end of main ---------------------------- gets executed in the main itself. the control will be transfered automatically from the method 'volume()' in Class Box to the stmt1 and is assigned to vol and next the println stmt gets executed and hence it reaches the end of main method, it terminates.and if u write any code like another call to volume method after stmt2 then that will execute and gets terminated. hope this clears ur doubt.if not feel free to ask me. cheers & regds, Mahesh
I think you are asking how a method knows where to return to.
Basically, the process of calling a method includes saving the return address in a work area called a "stack frame". Any return statement will retrieve the return address from the stack frame and go there.
There is a lot more to the call/return process, but this is what you asked.