Page 915 - AP Computer Science A, 7th edition
P. 915
16. (C) The String temp represents a single-character substring of s. The method examines each character in s and, if it is a nonblank, appends it to str, which is initially empty. Each assignment str += temp assigns a new reference to str. Thus, str ends up as a copy of s but without the blanks. A reference to the final streturned. Choice A is correct in tr object is returned. Choice A is correct in that s is left unchanged, but it is not the best characterization of what the method does. Choice B is not precise because an object parameter is never modified: Changes, if any, are performed on a copy. Choices D and E are wrong because the method removes blanks.