Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite0
var Variables in Java?!?!
does it exist a Variable type that gives the variable automatically his type? i mean in c# it is existing. example; var Var = 12 and then Var is a int
3 Réponses
+ 3
Nope, as far as i know all variables in java must be explicitly declared with a data type.
+ 1
int var = 12;
/*this would give you a variable named "var" and a value of 12.java doesn't automatically declare variable type.
*/
0
It always pays to define your variables (even in c#) as if YOU don't know what type to set, how do you expect your program to know and capture errors? There's a saying: "Garbage In, Garbage Out" :)