switch with char value
import java.util.Scanner; public class MainCLass { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { System.out.print("Enter the package code: "); String s = sc.next(); char p = s.charAt(0); String details = ""; switch (p) { case 'E': case 'e': details += "\tE...\n"; case 'D': case 'd': details += "\tD...\n"; case 'C': case 'c': details += "\tC...\n"; case 'B': case 'b': details += "\tB...\n"; case 'A': case 'a': details += "\tA.\n"; break; default: details = "That's"; break; } System.out.println(details); } }