From 728e8d2cc853f8329322f2fcf79b9172470845ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20M=C3=BCller?= Date: Fri, 9 Apr 2021 20:18:56 +0200 Subject: [PATCH] Adding InputReader --- .../src/com/p4ddy/java_tutorial/InputReader.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Gabriel-Java-Learning/src/com/p4ddy/java_tutorial/InputReader.java diff --git a/Gabriel-Java-Learning/src/com/p4ddy/java_tutorial/InputReader.java b/Gabriel-Java-Learning/src/com/p4ddy/java_tutorial/InputReader.java new file mode 100644 index 0000000..ea0adc9 --- /dev/null +++ b/Gabriel-Java-Learning/src/com/p4ddy/java_tutorial/InputReader.java @@ -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; + } +}