Let's say I wanted to instantiate a bowl of cereal. We don't really need to create a whole new class for this. Instead we can define fields of type Food in the Food class and use those to compose a larger object.
First, let's define fields in the Food class to represent the two parts of cereal: a milk and a grain.
There is nothing 'illegal' about this. The code will build just fine. So now, those two fields have the same members as the Food class.
So in the MainWidnow we can write this block of code:
A new Food object is being instantiated, then Food inside that same object is being instantiated. If we run the application we can see that the "Cereal" object has both a Milk and a Grain object that are both Food types.