Saturday, January 31, 2015

Beckett.java in pgm



Beckett.java

public class Beckett
 {
 public static void moves(int n, boolean forward) 
 {
        if (n == 0) return;
        moves(n-1, true);
        if (forward) System.out.println("enter " + n);
        else         System.out.println("exit  " + n);
        moves(n-1, false);
    }
                public static void main(String[] args) 
                {
        int N = Integer.parseInt(args[0]);
        moves(N, true);
    }
}

No comments:

Post a Comment