Given the following:
Which code fragment can be used to replace the if block?
if
A nested conditional expression can assign "Walter" when stuff.equals("TV") is true; otherwise, it evaluates stuff.equals("Movie") to choose "White" or "No Result". This preserves the same conditions and assignments as the original control flow.
"Walter"
stuff.equals("TV")
stuff.equals("Movie")
"White"
"No Result"
Community Discussion