Java Scanner Usage getChar()

Here you can find the source of getChar()

Description

get Char

License

Open Source License

Declaration

public static char getChar() 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Scanner;

public class Main {
    private final static Scanner commandLine = new Scanner(System.in);

    public static char getChar() {
        char choice;
        String line = commandLine.nextLine().toLowerCase().trim();
        if (line.length() == 0) {
            choice = ' ';
        } else//from w w  w  . ja  va2  s  .  co  m
            choice = line.charAt(0);
        return choice;
    }
}

Related

  1. createScannerForString(String s)
  2. enterToContinue()
  3. equalsToIgnoreEndline(String expected, String actual)
  4. fromStringToQuery(String value)
  5. getBoolean()
  6. getConstantPoolsFromText(String text)
  7. getDirectoryString()
  8. getEndLine(String cqlString)
  9. getExtensions(Scanner scanner)