The following statements:
URLClassLoader ucl = (URLClassLoader) ClassLoader.getSystemClassLoader();
Class uclc = ucl.getClass();
Covariance vs contravariance vs invariance
Class extends URLClassLoader> is invariant.As a result,
Class extends URLClassLoader> is not a subtype of Class
In Java a variable can hold a reference of an instance of same type or subtype.
Hence,
Class uclc = ucl.getClass();
is invalid.
On the other hand,
Class extends URLClassLoader> uclc = ucl.getClass();
would be valid.