What is output by the following Java code segment?

```
int temp = 180;
while (temp != 80) {
if (temp > 90) {
System.out.print("This porridge is too hot! ");
// cool down
temp = temp – (temp > 150 ? 100 : 20);
}
else {
if (temp < 70) {
System.out.print("This porridge is too cold! ");
// warm up
temp = temp + (temp < 50 ? 30 : 20);
}
}
}
if (temp == 80) {
System.out.println("This porridge is just right!");
}
```

a. This porridge is too cold! This porridge is just right!
b. This porridge is too hot! This porridge is just right!
c. This porridge is just right!
d. None of the above.


b. This porridge is too hot! This porridge is just right!

Computer Science & Information Technology

You might also like to view...

Java and JavaScript refer to the same language

Indicate whether the statement is true or false

Computer Science & Information Technology

What is the advantage of creating a form with a subform?

What will be an ideal response?

Computer Science & Information Technology

Excel provides a gallery of text styles known as ________ that can be used to create decorative effects on text

Fill in the blank(s) with correct word

Computer Science & Information Technology

Which of the following will allow the use of Bit Locker if the computer does not have a TPM chip?

A. External hard drive B. SCSI hard drive C. USB key D. CD-ROM drive

Computer Science & Information Technology