Java Utililty Methods Console Read

List of utility methods to do Console Read

  1. HOME
  2. Java
  3. C
  4. Console Read

Description

The list of methods to do Console Read are organized into topic(s).

Method

ArrayList getCommandArgs(String command)
get Command Args
ArrayList<String> list = new ArrayList<String>();
Scanner scanner = new Scanner(command);
scanner.useDelimiter(" ");
while (scanner.hasNext()) {
 list.add(scanner.next());
return list;
String getInScanner()
Membaca masukan data dari keyboard (pendekatan Scanner) Pembatas adalah carriage return (enter)
String s = "";
Scanner input = new Scanner(System.in).useDelimiter("\r");
s += input.next();
return s;
String getUserInput()
Read from console user string
Scanner scanner = new Scanner(System.in);
String userInput = scanner.nextLine();
return userInput;
String getUserInput()
get User Input
Scanner in = new Scanner(System.in);
String response = in.nextLine();
in.close();
return response;
String getUserInput(String text, int indentLevel)
get User Input
indent(indentLevel);
System.out.printf("%s: ", text);
Scanner scanner = new Scanner(System.in);
return scanner.nextLine();
String getUserInput(String whatever)
Obtain user input from command line
System.out.print("Enter " + whatever + " :");
@SuppressWarnings("resource")
Scanner scanner = new Scanner(System.in);
return scanner.nextLine();
int inputInt()
input Int
Scanner sc = new Scanner(System.in);
return sc.nextInt();
String inputString()
input String
Scanner sc = new Scanner(System.in);
String string = sc.next();
if (isNumeric(string))
 throw new InputMismatchException();
return string;
String readLine(Console console)
read Line
console.printf("> ");
return console.readLine().trim();


AltStyle によって変換されたページ (->オリジナル) /