class Cons extends List1 { private int first; private List1 next; public Cons(int h,List1 t) { first=h; next=t; } public int head() { return first; } public List1 tail() { return next; } public boolean isEmpty() { return false; } public String toString() { String str="["+first; for(List1 ptr=next; !ptr.isEmpty(); ptr=ptr.tail()) str+=","+ptr.head(); return str+"]"; } }