+ 9

What is concept of recursive method in java??

20th May 2019, 3:47 AM
Nasir❤
Nasir❤ - avatar
3 ответов
+ 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