public class Main { public static void main(String[] args) { Main main = new Main(); main.myMethod(5);} void myMethod( int counter){System.out.println("Method called with argument: "+counter);if(counter == 0) return;else { System.out.println(""+counter); myMethod(--counter); return; }} }
Standard input is empty
Method called with argument: 5 5 Method called with argument: 4 4 Method called with argument: 3 3 Method called with argument: 2 2 Method called with argument: 1 1 Method called with argument: 0
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!