p is a reference to a Person object
p.getCar() is a reference to a Car object
p.getCar().getName() is a reference to a
String object
In theory, so long as each method returns a reference to an object, you can string any number of "."s together.
In practice, it would be bad coding to put too many - certainly not more than what you've got here. For example, the following clearly does the same :
However, the advantage with splitting the code like this is it enables debugging and maintenance. You can log the value of myCar to ensure it's what you expected it to be, etc.