char initial = 'A'; Character initialChar = Character.valueOf(initial); System.out.println("initialChar = " + initialChar);
char letter = 'w'; switch (Character.valueOf(letter)) { case 'a': case 'e': case 'i': case 'o': case 'u': System.out.println("Vowel"); break; default: System.out.println("Consonant"); break; }In this example, we have a `char` variable `letter` which is used as the input for the `valueOf` method in a switch statement. The switch statement checks if the character is a vowel or consonant and prints the appropriate message to the console. The `valueOf` method is part of the `java.lang` package library, which is automatically imported by Java programs.