Adding InputReader

This commit is contained in:
Patrick Müller 2021-04-09 20:18:56 +02:00
parent e8ed1dc746
commit 728e8d2cc8

View File

@ -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;
}
}