UNB/ CS/ David Bremner/ teaching/ old/ cs1083/ java/ ObjFact.java
public class ObjFact{
    private int n;
    private ObjFact child = null;
    public ObjFact(int n){
        this.n=n;
        child = null;
    }
    public int fact(){
        if (n<=1) {
            return 1;
        } else {
            child=new ObjFact(n-1);
            return n* child.fact();
        }
    }
    public static void main(String args[]){
        ObjFact obj=new ObjFact(10);
        System.out.println(obj.fact());
    }
}