r/JavaProgramming • u/alvivan_ • Aug 26 '26
Var Keyword
How often do you use var keyword in your code?
What do you think about it?
5
Upvotes
r/JavaProgramming • u/alvivan_ • Aug 26 '26
How often do you use var keyword in your code?
What do you think about it?
1
u/Scf37 Aug 26 '26
I prefer to type 'int' instead of 'var', then IDEA autofix via alt-enter replaces it with the right type.
Good places for var (IMO):
for loops: `for (var item: items)`
deconstruction in pattern matching: `case Either.Right(var v) ->`