+ 9

What is concept of recursive method in java??

20th May 2019, 3:47 AM
Nasirā¤
Nasirā¤ - avatar
3 Answers
+ 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
20th May 2019, 3:54 AM
Alessio Benvenuti
Alessio Benvenuti - avatar
+ 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.
20th May 2019, 4:36 AM
Troy🌹
Troy🌹 - avatar