0

Hie can i ask what is wrong with my code

import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int emotion = scanner.nextInt(); /* 1 - "You are happy!" 2 - "You are sad!" 3 - "You are angry!" 4 - "You are surprised!" other - "Unknown emotion." */ switch(emotion){ case 1: System.out.print("You are happy!"); break; case 2: System.out.print("You are sad!"); break; case 3: System.out.print("You are angry!"); break; case 4: System.out.print("You are suprised!"); break; default: System.out.print("Unknown emotion."); } } }

31st Jul 2022, 7:51 AM
Maposa Lyson
4 Answers
+ 7
Maposa Lyson There is nothing wrong in the syntax , your code runs well
31st Jul 2022, 7:59 AM
Suparna Das
Suparna Das - avatar
+ 1
code is ok, but there is a typo in "surprised"
31st Jul 2022, 8:02 AM
zemiak
0
Can someone help me
31st Jul 2022, 7:52 AM
Maposa Lyson
0
Ok thank you let me correct it
31st Jul 2022, 8:06 AM
Maposa Lyson