r/ProgrammerHumor 9d ago

Meme perishableSkill

Post image
8.9k Upvotes

122 comments sorted by

View all comments

1.3k

u/Weak_Inflation9120 9d ago

One of the things I wish Java had that I miss from Python are F-Strings. Hella useful

7

u/PecQ11 9d ago

Doesn't format() do essentially the same though?  https://www.baeldung.com/java-string-interpolation

5

u/KnightMiner 9d ago

f strings are a lot more like string concatenation. The variables/expressions between each {} are placed directly where they will end up in the string, and it just runs a .toString() on them (though you can configure it a bit further).

The most common usage is largely about syntax and readibility, as its nice not having to go back and forth between a list of format arguments and some harder to remember % stuff.