# Is this String concatenation creating extra String?

Using the eclipse formatting on a class with some @NamedQueries created concatenations.

While I have been doing this for years without paying attention I just realised that may be it is not a good usage.

So basically Which one of these Strings inside the queryis better ? Is the second one creating too many Strings? Should I be bothered at all?

My answer would be yes second one is creating extra Strings but I am not sure I should be concerned.

First Query

 @NamedQuery(
name = SomeConstant,
query="SELECT person FROM Person person Where person.name = :name ")


Second Query

 @NamedQuery(
name = SomeConstant,
query="SELECT person FROM Person person"+" "+
"Where person.name = :name ")


• Byte code editor confirms that Strings are exactly the same. – Shahzeb May 23 '12 at 0:47