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?
Printable View
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?
I'll get you started:
Give it a try, and post what you come up with.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);
}
}
-Gary-