What is wrong with the following switch statement? int ans; System. out. print ("Type y for yes or n for no"); ans = scan. nextInt (); switch (ans) { case 'y': case 'Y': System. out. println ("You said yes"); break; case 'n': case 'N': System. out. println ("You said no"); break; default: System. out. println ("invalid answer"); }
+1
Answers (1)
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “What is wrong with the following switch statement? int ans; System. out. print ("Type y for yes or n for no"); ans = scan. nextInt (); ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Home » Computers & Technology » What is wrong with the following switch statement? int ans; System. out. print ("Type y for yes or n for no"); ans = scan. nextInt (); switch (ans) { case 'y': case 'Y': System. out. println ("You said yes"); break; case 'n': case 'N': System. out.