The other answers explain well why only 1 String is added to the String pool. But if you want to check and make some tests by yourself you can take a look on the bytecode to see the number of String created and added to the string pool. Ex:
Ex1:
public static void main(String[] args) { String hi = "Tom" + "Brady" + "Goat"; }
ByteCode:
// access flags 0x9 public static main(String[]) : void L0 LINENUMBER 6 L0 LDC "TomBradyGoat" ASTORE 1 L1 LINENUMBER 7 L1 RETURN L2 LOCALVARIABLE args String[] L0 L2 0 LOCALVARIABLE hi String L1 L2 1 MAXSTACK = 1 MAXLOCALS = 2
As you can see only 1 String is created
Ex2:
public static void main(String[] args) { String str1 = "Tom"; String str2 = "Brady"; String str3 = "Goat"; String str = str1 + str2 + str3; }
Bytecode:
// access flags 0x9 public static main(String[]) : void L0 LINENUMBER 6 L0 LDC "Tom" ASTORE 1 L1 LINENUMBER 7 L1 LDC "Brady" ASTORE 2 L2 LINENUMBER 8 L2 LDC "Goat" ASTORE 3 L3 LINENUMBER 9 L3 NEW StringBuilder DUP ALOAD 1: str1 INVOKESTATIC String.valueOf (Object) : String INVOKESPECIAL StringBuilder.<init> (String) : void ALOAD 2: str2 INVOKEVIRTUAL StringBuilder.append (String) : StringBuilder ALOAD 3: str3 INVOKEVIRTUAL StringBuilder.append (String) : StringBuilder INVOKEVIRTUAL StringBuilder.toString () : String ASTORE 4 L4 LINENUMBER 10 L4 RETURN L5 LOCALVARIABLE args String[] L0 L5 0 LOCALVARIABLE str1 String L1 L5 1 LOCALVARIABLE str2 String L2 L5 2 LOCALVARIABLE str3 String L3 L5 3 LOCALVARIABLE str String L4 L5 4 MAXSTACK = 3 MAXLOCALS = 5
As you can see 4 Strings are created