KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
How do I use a character in a switch-case? I will be getting the first letter of whatever the user inputs. import javax.swing.*; public class SwitchCase { public static void main (String[] args) { String hello = ""; hello = JOptionPane.showInputDialog("Input a letter: "); char hi = hello; switch(hi) { case 'a': System.out.println("a"); } } }
Tags (comma-separated)
Save Edits
Cancel