Closed ngdeqi closed 1 year ago
Hi, AFAIK, in nameList.getByIndex(2).getHeight()
, essentially what it does is to call nameList.getByIndex(2)
first, and on the object returned it calls getHeight()
method.
You can picture nameList.getByIndex(2).getHeight()
into something like this:
Person temp = nameList.getByIndex(2)
int height = temp.getHeight();
Since the method getHeight()
is called on the object after the object is returned back to main()
, the getHeight
should be invoked by Main
in sequence diagram.
Please take a look at the tutorial question that deals with this scenario.
Thank you for the explanation! @wcwy
Hi all, how should I draw a sequence diagram for the chained method call,
nameList.getByIndex(2).getHeight()
fromMain
?I am not sure if
getHeight()
should be invoked byMain
orNameList
object.