Java 15.2 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Java 15.2

I entered the code to the best of my ability, but for the life of me- I just can't seem to find out what the last edge case is. Below is a sample of my code. switch(emotion){ case 1: System.out.println("You are happy!"); case 2: System.out.println("You are sad!"); case 3: System.out.println("You are angry!"); case 4: System.out.println("You are surprised!"); default: System.out.println("Unknown emotion."); }

26th Aug 2021, 9:22 AM
KtjCodes
KtjCodes - avatar
5 Answers
+ 7
You're missing a "r" in surprised!
26th Aug 2021, 9:24 AM
Simba
Simba - avatar
+ 3
Is that a typo in the '2 case'? I guess it should've been like ... System.out.println( ... );
26th Aug 2021, 9:25 AM
Ipang
+ 3
case 2 printl m typo case 4 ; missed default ; missed add break after each case
26th Aug 2021, 1:44 PM
zemiak
+ 2
In suprised you missed r
26th Aug 2021, 9:38 AM
Ananya | Inactive |
Ananya | Inactive | - avatar
+ 2
These people are sneaky
26th Aug 2021, 2:52 PM
KtjCodes
KtjCodes - avatar