 Here's the class we developed in a preceding video to represent a rectangle, and here's a test program that calls the git area and git perimeter methods of two different rectangles and prints the results. Let's compile that and run it, and that works. What we'd like to do is print out the value of the rectangle so that we can see their width and height. Let's give it a try by doing this. System.out.println r1 is plus r1, and then here System.out.println r2 is plus r2. Compile that, and let's see what happens when we run the program this time. We get the object class and its memory location. It's not terribly helpful, and it's certainly not what we want. In order to get more useful output, we need to go to the class definition and define a new method. This will be a public method that returns a string, and its name will be two string. This method has no parameters. The body of the method will create a string that contains the information we want to see when we print the object. Let's create a string called result, and that will be string.format, and the format string will be width, and a placeholder, height, and a placeholder. The placeholders will be filled in with the width and height fields from our class. Two important things to notice here. First, we're not using System.out.printf. This method should not print anything. Instead, we're using string.format, which does the same thing as printf, but puts the result into a string rather than on the screen. The second thing to notice is that we didn't put a new line here. The string that we returned doesn't have a new line. We'll leave that up to whoever called us to decide whether they want one or not. Now let's return that result and compile. When we come back to our test program and run it again, now we have the output that we want. You'll notice that I didn't say two string anywhere here. That's because Java is taking care of that for us. Whenever it sees an object that's going to be added onto another string, it implicitly calls the toString method. We can call it explicitly. We could say r2.toString in this line, compile it, and it will work the same. The decision of whether to call toString implicitly or explicitly is up to you. I just want you to know that both options are available. And that's how you can get useful output of the contents of an object by creating your own toString method.