Dylan Kwon wrote:For the above code, why does changing sb1, the parameter variable, change sb2?
The code doesn't change the variable. It changes the StringBuilder which the variable refers to, which is also the StringBuilder which sb2 refers to. To change the variable would require code like "sb1 = ...".
For the above code, why is "hey oh hi" appended before "yo?"
It isn't exactly "appended" -- that isn't the
word I would use. It's just written to the console before "yo" is written to the console. Look at the two System.out.println() statements and see what they print.