Java Console Read getUserInput(String whatever)

Here you can find the source of getUserInput(String whatever)

Description

Obtain user input from command line

License

Apache License

Parameter

Parameter Description
whatever a parameter

Return

the input from the command line

Declaration

public static String getUserInput(String whatever) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Scanner;

public class Main {
    /**/*from  w ww  . j av  a2s  .c  o  m*/
     * Obtain user input from command line
     * 
     * @param whatever
     * @return the input from the command line
     */
    public static String getUserInput(String whatever) {

        // prompt the user to enter whatever
        System.out.print("Enter " + whatever + " :");
        @SuppressWarnings("resource")
        Scanner scanner = new Scanner(System.in);
        return scanner.nextLine();
    }
}

Related

  1. getCommandArgs(String command)
  2. getInScanner()
  3. getUserInput()
  4. getUserInput()
  5. getUserInput(String text, int indentLevel)
  6. inputInt()
  7. inputString()
  8. readLine(Console console)