Click on base.java to get source.
import java.lang.*;
import java.io.*;

public class base implements Cloneable {
protected int size;
protected int[] data_arr; // gets allocated by constructor
public base (int n)
     { System.out.print("base constructor with arg: ");
       System.out.println(n);
       size = n;
       data_arr = new int[n];
     }
protected void finalize()
     { System.out.println("base finalizer");
       // note: not the same as a C++ destructor,
       //       as memory is freed automatically
       //       called before the object is garbage collected
     }
public base()
     { this(10); // call alternative constr.; must be first statement!
       System.out.println("before: base constructor without arg");
     }
public Object clone()
   // this method makes a new object as a copy of b
     { System.out.println("base clone method");
       base b = new base(size);
       for(int i=0; i<size; i++) b.data_arr[i] = data_arr[i];
       return b;
     } 

public void print(PrintWriter os)
     { // can supply either a   new PrintWriter(System.out)
       //            or a       new PrintWriter(new CharArrayWriter())
       //                       (see toString below)
       os.print("write base obj to stream: size = ");
       os.print(size);
     }

public String toString()
     { // with above print method,
       // toString always can be implemented like this
       CharArrayWriter buf = new CharArrayWriter();
       PrintWriter os = new PrintWriter(buf);
       print(os);
       return buf.toString();
     }
}// end class base