'this' refers to the current instance of Tail - which is all of its properties (n, prim, and last) & methods. If you want to overwrite toString() using the three properties refer to this answer for how to write your for loop: