package javatemplate1;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class JavaTemplate1
{
public static void main(String[] args) throws IOException {
System.out.println("main block executing");
// Launching Application where Satge equals to window
//scene will contain children nodes using a container class
// like Group or Pane Class
BufferedReader br = new BufferedReader(new
InputStreamReader(System.in));
System.out.print("Type a number :");
String str = "";
str = br.readLine();
int y = Integer.parseInt(str);int x=1;
javarecursions(y, 0, 1, 2);
}
private static void javarecursions(int disks, int from, int to, int
holder) {
String strx1;
strx1 = Integer.toString(disks);
if (disks == 1) {
// Only one disk to be moved.
System.out.print("Move disk :: "+strx1+ " from stack "+ from + " to
stack "+ to +"\n");
}
else {
// Moving all but one disk at the bottom, to the spare stack, then
// move the last-bottom disk RED, then put all three other disks on
top of it.
javarecursions(disks-1, from, holder, to);
System.out.print("Move disk "+(disks)+ " from stack "+ from+" to
stack "+ to+"\n");
javarecursions(disks-1, holder, to, from);
}
}
}