Solved

What Is Output by the Following Java Code Segment? Int

Question 9

Multiple Choice

What is output by the following Java code segment? int temp = 180;
If ( temp > 90 )
{
System.out.println( "This porridge is too hot." ) ;
// cool down
Temp = temp - ( temp > 150 ? 100 : 20 ) ;
} // end if
Else
{
If ( temp < 70 )
{
System.out.println("This porridge is too cold.") ;
// warm up
Temp = temp + (temp < 50 ? 30 : 20) ;
} // end if
} // end else
If ( temp == 80 )
System.out.println( "This porridge is just right!" ) ;


A) This porridge is too hot.
B) This porridge is too cold.This porridge is just right!
C) This porridge is just right!
D) None of the above.

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions