How many objects will be created
At runtime, 4, i.e. the four computed values of str, excluding the initial value which comes from the constant pool.
and how many objects will be available for garbage collection?
At the end of this code but before str goes out of scope, three, i.e. the three intermediate values of str.
Note that I am counting Strings. Each String will have an associated char[] which is another object.
However if the surrounding code is such that the JVM can determine that str cannot change between these lines of code it could be as low as one and zero respectively.