KnowledgeBoat Logo

Computer Applications

If a method contains several return statements, how many of them will be executed?

User Defined Methods

ICSE 2007

55 Likes

Answer

A method can have multiple return statements but only one of them will be executed because once a return statement is executed, the program control moves back to the caller method skipping the remaining statements of the current method.

Answered By

30 Likes


Related Questions