Given the code fragment:
What is the result?
Given the code fragment:
What is the result?
The code initializes a boolean variable 'checkOut' to true and an integer variable 'days' to 0. It then enters a while loop that continues as long as 'checkOut' is true. Inside the loop, 'days' is incremented by 1 on each iteration. When 'days' becomes greater than 3, 'checkOut' is set to false, ending the loop. At this point, 'days' is 4, so 'System.out.print(days);' will output 4.
will print Sysout only one time when pointer exits from while loop that is days = 4. So B is correct answer
B is the correct answer.
Correct answer is B