Solution Review: What Day Is It?
In this review, the solution of the challenge What Day Is It? from the previous lesson is provided.
We'll cover the following...
We'll cover the following...
Solution: did you find the right day? #
Press + to interact
Java
class HelloWorld {public static void main( String args[] ) {int x =3;String answer = "";switch (x) {case 1:answer = "Monday";break;case 2:answer = "Tuesday";break;case 3:answer = "Wednesday";break;case 4:answer = "Thursday";break;case 5:answer = "Friday";break;case 6:answer = "Saturday";break;case 7:answer = "Sunday";break;default:answer = "invalid input";}System.out.println(answer);}}
Understanding the code
1. Line 5: ...