Results 1 to 2 of 2
  1. #1
    snowMac is offline Member
    Join Date
    Mar 2011
    Posts
    1
    Rep Power
    0

    Default Convert Recursive Method to Java

    I found a cool recursive method in Python, I'd like to use it in Java. Here's the link: Ideone.com | Online Python Interpreter & Debugging Tool

    Any idea how I can use this and play with it in Java?

  2. #2
    gcalvin is offline Senior Member
    Join Date
    Mar 2010
    Posts
    953
    Rep Power
    5

    Default

    I'll get you started:

    Java Code:
    public class Diamond {
    
        public void displayDiamond(int stars) {
            displayDiamond(stars, 1);
        }
    
        public void displayDiamond(int stars, int spaces) {
            // TODO: write this part
        }
    
        public static void main(String[] args) {
            new Diamond().displayDiamond(5);
        }
    }
    Give it a try, and post what you come up with.

    -Gary-

Similar Threads

  1. Replies: 3
    Last Post: 02-09-2010, 05:22 AM
  2. recursive method
    By michail in forum New To Java
    Replies: 0
    Last Post: 01-31-2010, 01:50 PM
  3. Java Recursive method problem
    By kj2009 in forum Advanced Java
    Replies: 2
    Last Post: 02-25-2009, 03:19 PM
  4. exercise of recursive method
    By amexudo in forum New To Java
    Replies: 2
    Last Post: 03-09-2008, 05:55 PM
  5. Recursive Method
    By bluegreen7hi in forum New To Java
    Replies: 5
    Last Post: 11-29-2007, 04:45 AM

Tags for this Thread

Posting Permissions

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