0
is there a generic variabels in solo learn(java)
if there is can someone explain to me how to use it
2 Respuestas
+ 17
Generic function is very useful if you do not know what the user is going to do, you can use generic function or generic class.
Examp : if user enter a Integer number Than generic funtion or class automatically convert a generic parameter to this type.
Syntax : for classes
class <T> // here T repersant as generic type parameter you can use any alphabat you want.
For function
public void fun(T a)
Here T repersant generuc Type and a automatically converts to that type.
0
Tnx this is helpfull