Adding InputReader
This commit is contained in:
parent
e8ed1dc746
commit
728e8d2cc8
|
@ -0,0 +1,13 @@
|
||||||
|
package com.p4ddy.java_tutorial;
|
||||||
|
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
public class InputReader {
|
||||||
|
public static String getInput(String textToAsk){
|
||||||
|
Scanner myObj = new Scanner(System.in); // Create a Scanner object
|
||||||
|
System.out.println(textToAsk);
|
||||||
|
|
||||||
|
String input = myObj.nextLine(); // Read user input
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user