```class MyClass<T> { var prop: T = null...
# getting-started
p
Copy code
class MyClass<T> {
    var prop: T = null // error
}
why does this not work? I thought that the upper bound of a type parameter is by default
Any?
i
I believe the issue you'll have here is that T could also be "Any" not just "Any?". For example:
Copy code
val myThing = MyClass<String>()
val otherThing = MyClass<String?>()
What you might want to do is to use a non-nullable T (i.e.
class MyClass<T: Any>()
) and a nullable prop definition
Daniel Cheng's example shows what I mean
p
thanks, I think I get it