Java Switch Statement Exercises
Java Switch Statement Exercises
Exercise 3: Seasons
Create a Java applica�on which will prompt the user to type in any month number (1-12). Code a
switch statement that will display the appropriate season.
The seasons according to the months are:
• Summer: November, December, January and February.
• Autumn: March, April and May.
• Winter: June, July, August.
• Spring: September and October.
What is the correct way to declare a variable to store an integer value in Java?
a. int 1x = 10;
b. int x = 10;
c. float x = 10.0f;
d. string x = "10";
Enter your choice:
------------------------------------------------------------------------------------------------
Possible responses for each choice:
a. Variable iden�fier cannot start with a number.
b. Correct. Well done!!!
c. Incorrect type altogether.
d. string is not an int. String must also start with a upper case S.