AI-powered
podcast player
Listen to all your favourite podcasts with AI-powered features
Java - Chapter Forty Three, Local Variable Type Inference
Since trava 11, there is local variable type inference in java. That's just a long way ofy ying that you can type v, a r instead of your type name on the left hand side. Some people think it's a bit like grovy's deaf, where you kindof have a kind of fluffy type, dynamic typing. But but it's not. If i can tell from the right hand what the type should be, i will use the right hand type rather than you having to literally type it two times on each side. The minute i start hitting the field level, it becomes a little more brittle.