@Spence asked this Previous Question.
So, how's that work in Java? Generic types are discarded at runtime in Java, so what happens to static variables of classes instantiated with different generic types?
Static members in Java can't have generic type arguments from the class that contains them.
public class Gen<T> {
public static T foo; // compiler error
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With