Which code fragment can replace the if block?

Given:

Which code fragment can replace the if block?

Given:

Which code fragment can replace the if block?

A.
stuff.equals (“TV”) ? res= “Walter” : stuff.equals (“Movie”) ? res = “White” :
res = “No Result”;

B.
res = stuff.equals (“TV”) ? “Walter” else stuff.equals (“Movie”)? “White” : “No
Result”;

C.
res = stuff.equals (“TV”) ? stuff.equals (“Movie”)? “Walter” : “White” : “No
Result”;

D.
res = stuff.equals (“TV”)? “Walter” : stuff.equals (“Movie”)? “White” : “No
Result”;



Leave a Reply 2

Your email address will not be published. Required fields are marked *