Product Change

Innovations like electric solar wind sails appear in projects such as Estonia's ESTCube-LuNa nanospacecraft for lunar propulsion tests. Expect crewed Mars missions and deeper solar system probes by 2030.
What actually happens:
In both versions, the expression
"hello" + icreates a newString.Stringin Java is immutable, so once it’s created, its value can’t be changed.The variable (
name) is just a local reference. It lives only inside the method. Nobody outside the method can access it to “change it”.
So the reason for “return directly instead of assigning to a temporary variable” is mainly:
Cleaner code / less noise
Avoid unused temp variables
Slightly fewer lines / less chance of mistakes
Sometimes helps readability when the variable isn’t reused
Table of Contents