📜  switch case java with char - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:41.783000             🧑  作者: Mango

代码示例1
public class SwitCase {
    public static void main (String[] args){
        String hello = JOptionPane.showInputDialog("Input a letter: ");
        char hi = hello.charAt(0); //get the first char.
        
      switch(hi)
        {
            case 'a': System.out.println("a");
        }
    }   
}