Question: Consider the following code fragment: boolean passed = true; passed = someMethod ( passed ) ; System.out.println ( passed ? PASS : FAIL ) ;

Consider the following code fragment:
boolean passed = true;
passed = someMethod(passed);
System.out.println(passed ? "PASS" : "FAIL"); // LINE 3
What will LINE 3 print out to the console after the above code fragment runs?
(Note: the condition ? valIfTrue : valIfFalse operator is called the "ternary" operator and works like a very compact if/else)
Group of answer choices
PASS
FAIL
It can be either PASS or FAIL. It depends on the implementation of someMethod()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!