public void recursiveMe(int n) { if(n <= 5) {// 5 is the max limit System.out.print("_");//print n recursiveMe(n+1);//call recursiveMe with n=n+1 } } recursiveMe(1); // call the function with 1.