Test Java covariance

Added a generic RandomTest class to play with Java language constructs.
This checkin is about Java covariance support.