Why do we use return in Java?

Samuel Rivera | 2023-05-05 14:09:53 | page views:1057
I'll answer
Earn 20 gold coins for an accepted answer.20 Earn 20 gold coins for an accepted answer.
40more

Scarlett Lee

Studied at the University of Amsterdam, Lives in Amsterdam, Netherlands.
It does not need to contain a return statement, but it may do so. In such a case, a return statement can be used to branch out of a control flow block and exit the method and is simply used like this: return; If you try to return a value from a method that is declared void , you will get a compiler error.
2023-05-14 14:09:53

Mia Walker

QuesHub.com delivers expert answers and knowledge to you.
It does not need to contain a return statement, but it may do so. In such a case, a return statement can be used to branch out of a control flow block and exit the method and is simply used like this: return; If you try to return a value from a method that is declared void , you will get a compiler error.
ask:3,asku:1,askr:137,askz:21,askd:152,RedisW:0askR:3,askD:0 mz:hit,askU:0,askT:0askA:4