1. Engineering
  2. Electronics Engineering
  3. stion text rewrite the following code into java statements using...

Question: stion text rewrite the following code into java statements using...

Question details

stion text

 

Re-write the following code into Java statements using the if/else keywords. 

Your final code should result in the same output as the original code below.

switch (temp)

{

    case 10: System.out.println(“Temp is cold.”);

                  break;

    case 20: System.out.println(“Temp is warm.”);

                  break;

    case 30: System.out.println(“Temp is hot.”);

                   break;

    default: System.out.println(“Temp is invalid.”)

}

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution