generics - Java get the default value of a type -
so i'm writing program in java after using c# few years , can't seem find answer anywhere. when creating generic<t>
class in c#, if want set variable default value of t
, use default(t)
. there same functionality in java , if how it?
java not have equivalent facility. if want pass value generic method must pass explicitly, if you're invoking type's default constructor.
Comments
Post a Comment