I am a little puzzled by the getClass method when used in generic type case:
def a[K](key: K) = {
println(key.getClass)
}
Shouldn't this always been AnyRef or Any or something? Since type K info is not available in runtime?
but a(3)
will output Int
, and a("fdasf")
will output String.
Alright, this is a silly question, I get confused by the K and key's type information.