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!
You might also like to view...
Which of the following is a key service that ought to be checked when evaluating vendor support?
A) Hardware Support B) Software Support C) Maintenance D) All of the above
To create a(n) ____ namespace, you add the following attribute to a document's root element: xmlns:prefix="namespace" where prefix is the prefix you'll use to mark elements in this namespace and namespace is the namespace id.
A. global B. default C. local D. main
The ____ function reads the next character in the input stream and assigns it to the function’s character variable.
a. getline() b. get() c. nextChar() d. getChar()
What is the Make Parent option used for?
What will be an ideal response?