KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I've been reading code produced by other developers on my team, they seem to favor using += for String concatenation, whereas I prefer using .concat() as it feels easier to read. I'm trying to prepare an argument as to why using .concat() is better, and I'm wondering, is there any difference in efficiency between the two? Which option "should" we be taking? public class Stuff { public static void main(String[] args) { String hello = "hello "; hello += "world"; System.out.println(hello); String helloConcat = "hello ".concat("world"); System.out.println(helloConcat); } }
Tags (comma-separated)
Save Edits
Cancel