Results 1 to 4 of 4

Thread: Recursion

  1. #1
    bozovilla is offline Member
    Join Date
    Nov 2007
    Posts
    19
    Rep Power
    0

    Default Recursion

    How do i use recursion method to print an array of number example, 1,2,3 backwards?

  2. #2
    maruthi_s is offline Member
    Join Date
    Jan 2008
    Posts
    20
    Rep Power
    0

    Default

    for(i=arr.length;i>0;i--)
    {
    System.out.println(arr[i]);
    }

  3. #3
    CaptainMorgan's Avatar
    CaptainMorgan is offline Moderator
    Join Date
    Dec 2007
    Location
    NewEngland, US
    Posts
    835
    Rep Power
    8

    Default

    maruth, unfortunately, that's not using recursion.

    Java Code:
    public void method() {
    // ask for input
    // if input does not equal zero, perform recursion
    // print number for this instance of function
    }
    Vote for the new slogan to our beloved Java Forums! (closes on September 4, 2008)
    Want to voice your opinion on your IDE/Editor of choice? Vote now!
    Got a little Capt'n in you? (drink responsibly)

  4. #4
    maruthi_s is offline Member
    Join Date
    Jan 2008
    Posts
    20
    Rep Power
    0

    Default

    exactly Morgan , I missed the recursion in the post :) oops :)

Similar Threads

  1. Help With Recursion
    By andrew777 in forum New To Java
    Replies: 1
    Last Post: 03-29-2008, 01:51 PM
  2. recursion
    By kdeighan in forum New To Java
    Replies: 3
    Last Post: 01-25-2008, 10:48 PM
  3. recursion
    By ravian in forum New To Java
    Replies: 2
    Last Post: 12-03-2007, 06:15 PM
  4. Help with recursion
    By scts102 in forum New To Java
    Replies: 1
    Last Post: 11-19-2007, 11:07 PM
  5. Recursion in java
    By lenny in forum Advanced Java
    Replies: 1
    Last Post: 08-07-2007, 07:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •