+ 9
What is concept of recursive method in java??
3 odpowiedzi
+ 4
Md. Nasir Uddin
Recursion is a basic programming technique you can use in Java, in which a method calls itself to solve some problem. A method that uses this technique is recursive.
This definition of factorial is recursive because the definition includes the factorial method itself.
source:
https://www.dummies.com/programming/java/what-is-recursion-in-java-programming/
I hope I was helpful
+ 3
https://www.sololearn.com/discuss/296069/?ref=app
https://www.sololearn.com/discuss/1023758/?ref=app
https://www.sololearn.com/discuss/787814/?ref=app
https://www.sololearn.com/discuss/307407/?ref=app
https://www.sololearn.com/discuss/1638452/?ref=app
https://www.sololearn.com/discuss/1294343/?ref=app
https://www.sololearn.com/discuss/1487214/?ref=app
https://www.sololearn.com/discuss/1716162/?ref=app
https://www.sololearn.com/discuss/311837/?ref=app
https://www.sololearn.com/discuss/1486703/?ref=app
https://www.sololearn.com/discuss/819959/?ref=app
https://www.sololearn.com/discuss/1149517/?ref=app
https://www.sololearn.com/discuss/120350/?ref=app
https://www.sololearn.com/discuss/1013104/?ref=app
+ 1
recurse()method is called from inside the main method at first (normal method call).
Also, recurse() method is called from inside the same method, recurse(). This is a recursive call.
The recursion continues until some condition is met to prevent it from execution. If not, infinite recursion occurs.
Hence, to prevent infinite recursion, if...else statement (or similar approach) can be used where one branch makes the recursive call and other doesn't.