Java Console Read inputString()

Here you can find the source of inputString()

Description

input String

License

BEER-WARE LICENSE

Declaration

protected final static String inputString() 

Method Source Code

//package com.java2s;
//License from project: BEER-WARE LICENSE 

import java.util.InputMismatchException;
import java.util.Scanner;

public class Main {
    protected final static String inputString() {
        Scanner sc = new Scanner(System.in);

        String string = sc.next();
        if (isNumeric(string))
            throw new InputMismatchException();

        return string;
    }//from  www . ja  v  a2  s.c om

    protected final static boolean isNumeric(String string) {
        return string.matches("[-+]?\\d*\\.?\\d+");
    }
}

Related

  1. getUserInput()
  2. getUserInput()
  3. getUserInput(String text, int indentLevel)
  4. getUserInput(String whatever)
  5. inputInt()
  6. readLine(Console console)