Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class RecursionExample {
- public static void main(String[] args) {
- recurseMethod(4);
- }//end method main
- static void recurseMethod(int num){
- if(num == 0)
- return;
- else{
- System.out.println("hello " + num);
- recurseMethod(--num);
- System.out.println(""+num);
- return;
- }//endif
- }//end method recurseMethod
- }//end class RecursionExample
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement