+ 2

How to make recursive program in Java?

5th Jan 2018, 10:13 AM
Kevin Wijaya
Kevin Wijaya - avatar
2 Réponses
+ 4
Simply make a function that calls itself. Public int iterateToTen(int i) { If (i=10){ return i; } else if(i<10) { i=i+1; return interateToTen(i) ; } else { i=i-1; return interateToTen(i) ; } }
5th Jan 2018, 10:35 AM
josh mizzi
josh mizzi - avatar
0
I understand a little more, but… Can you give me more example about recursive program in Java?
5th Jan 2018, 2:30 PM
Kevin Wijaya
Kevin Wijaya - avatar