switch case java with char

Solutions on MaxInterview for switch case java with char by the best coders in the world

showing results for - "switch case java with char"
Carlos
17 Oct 2016
1public class SwitCase {
2    public static void main (String[] args){
3        String hello = JOptionPane.showInputDialog("Input a letter: ");
4        char hi = hello.charAt(0); //get the first char.
5        
6      switch(hi)
7        {
8            case 'a': System.out.println("a");
9        }
10    }   
11}