Before we start, did you try solving the workbook yourself?
If not, please click the link in the resources folder and follow the instructions for this workbook.
Welcome to Workbook 7.7.
In this workbook, we're just going to print our object.
And by virtue of adding our two string method to the person class, it's going to get called whenever
we print an object of that class.
So here we'll say public string to string.
And we're just going to return the following string.
Here, we can fill in all the placeholders, pause the video, and feel free to do that one yourself.
So I hope you ended up with the following here.
We're just printing every single field in the object that's calling the two string method, and an object
will call the two string method whenever it's being printed.
So here I'm just going to print.
The person object and let us visualize the runtime.
So what I'm going to do is add a breakpoint over here.
One here.
Press debug.
And by virtue of printing and object of the person class, it's going to call the two string method.
Let's press continue.
Indeed it does.
This points to the current object that's calling this method.
And what it's going to do is return every single field in that object within a string.
Which then gets printed.