Why does the type conversion from Class[String] to Class[Any] compile successfully ?
object Test extends App {
var anyClass: Class[Any] = classOf[Any]
val strClass: Class[String] = classOf[String]
/* The following codes compile error: Expression of type Class[String] doesn't conform to expected type Class[Any]. */
//oClass = sClass
/* The following codes compile and run successfully. */
val str2anyClass = strClass.asInstanceOf[Class[AnyRef]]
println(str2anyClass.toString) // Output: class java.lang.String
}