Read char from console using Scanner - Java File Path IO

Java examples for File Path IO:Scanner

Description

Read char from console using Scanner

Demo Code

import java.util.Scanner;

public class CharacterInputOutput {

    public static void main(String cLA[]) {

        Scanner myInput = new Scanner(System.in);

        char myCharacter = myInput.next().charAt(0);

        System.out.printf("%c\n", myCharacter);
        System.out.println(myCharacter);
    }//from w  w  w  .  ja v a 2  s .c o  m
}

Related Tutorials