When I define a StringBuffer variable with new, this string is not added to the String pool, right?
StringBuffer
new
Now, when I define another String
String
Actually your teacher is referring to XXX . which goes to StringPool because all string literals written in java program goes to StringPool while execution...
XXX