practice final solutions question 6a

9 views
Skip to first unread message

Tina Wang

unread,
Dec 14, 2011, 6:56:47 PM12/14/11
to CPSC410-2011
Why was {a} added?

Eric Wohlstadter

unread,
Dec 14, 2011, 7:00:51 PM12/14/11
to cpsc41...@googlegroups.com
"a" is assigned to the return value of "foo".

Method Summary computes that "foo" may sometimes return null.

Also, using Method Summary it is not possible to distinguish which calls to "foo" are the ones that may return null.

So Method Summary must assume that the first call to "foo" might return null.

Eric


On Wed, Dec 14, 2011 at 3:56 PM, Tina Wang <twan...@gmail.com> wrote:
Why was {a} added?

stephanie pan

unread,
Dec 14, 2011, 11:28:52 PM12/14/11
to CPSC410-2011
so if "foo" returns not null, it will force it to return null?
Also, what if the first call to "foo" returns null but the second call
to "foo" doesn't return null, will the result also be forced to be
null?

Thank you

Reply all
Reply to author
Forward
0 new messages