new BorderLayout() invokes a constructor and returns an object reference. The method setLayout() wants just such an object reference as an argument.
Any argument can be an expression that evaluates to the proper type. This time they made a new thing of the proper type. You could call a method on the same object or another object that returns the type:
The options are endless. Neat, huh? [ October 06, 2006: Message edited by: Stan James ]
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
new BorderLayout() returns an object. that object is being passed as the argument to setLayout().
note that you could have done it this way...
Note that often it is perferable to split them into two lines... it can be hard to find problems if the inner method call fails and you end up passing a null object into your method. very strange things can happen
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors