How to use scanner to accept char type characters in Java import java.util.Scanner; Scanner scanner=new Scanner(); char sex=scanner.next().charAt(0);