you created sb with value "abc" then
sb.append("def") means appending "def" to "abc" results sb = "abcdef"
Now you created sb1 with value "abc" then sb1.append("def").reverse().insert(3, "---"); where first
sb1.append("def") gives "abcdef" then
.reverse("abcdef") gives "fedcba" then
.insert(3, "---"); means insert "---"
String at offset 3 so in "fedcba" at 3 is c so it inserts "---" there and results sb1 = "fed---cba"
Output:
sb>>abcdef
sb1>>>fed---cba