adhoc/universal polymorphism

Can you just give me some good examples of adhoc and universal polymorphism. http://www.javaworld.com/javaworld/jw-04-2001/jw-0413-polymorph_p.htmlI have gone through the link and i couldnt find itplease give me more examples Renjith.
[277 byte] By [renjithkva] at [2007-9-29 16:11:23]
# 1

Ad hoc overloading - Java's overloading:

public void print( Employee anEmployee );

public void print( TPSReport aReport );

print() can be used polymorphically w/ Employee and TPSReport objects.

Ad hoc coercion - Java's primitive conversions:

double d = 4.5f;

f is coerced into a double. d is declared to hold doubles, but it's now holding a float.

Universal inclusion - Java's inheritence

ArrayList al = new ArrayList();

System.out.println( al.toString() );

ArrayList doesn't define a toString() method. It's actually defined in AbstractCollection. But, because of Java's typesystem, ArrayList "includes" AbstractCollection's implementation of toString(), because ArrayList is a subtype of AbstractCollection.

Universal parametric - Java 1.5's Geenrics, C++'s Templates

mnadela at 2007-7-15 14:23:43 > top of Java-index,Other Topics,Patterns & OO Design...