Anran

InputReader.java

Nov 9th, 2020
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.69 KB | None | 0 0
  1.  
  2. /**
  3.  * The InputReader class represents an input reader generator object.
  4.  * It is used to read an input string.
  5.  *
  6.  * @author Andika Nugrahanto
  7.  * @version 9-11-2020
  8.  */
  9.  
  10. import java.util.Scanner;
  11. public class InputReader
  12. {
  13.     private Scanner read;
  14.  
  15.     /**
  16.      * Constructor for objects of class InputReader
  17.      */
  18.     public InputReader()
  19.     {
  20.         read = new Scanner(System.in);
  21.     }
  22.  
  23.     /**
  24.      * Read the input string from user
  25.      *
  26.      * @return    A string that explain the user problem
  27.      */
  28.     public String getInput()
  29.     {
  30.         System.out.print("> ");
  31.         String inputLine = read.nextLine();
  32.        
  33.         return inputLine;
  34.     }  
  35. }
  36.  
Advertisement
Add Comment
Please, Sign In to add comment