From fc7047bb74e3429221ed3a60abade05b854d53e5 Mon Sep 17 00:00:00 2001 From: 1-karthigeyan-1 Date: Fri, 2 Oct 2020 21:26:10 +0800 Subject: [PATCH] modified Ui class --- src/main/java/duke/Ui.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/duke/Ui.java b/src/main/java/duke/Ui.java index c2d6c946cb..41cdf251f4 100644 --- a/src/main/java/duke/Ui.java +++ b/src/main/java/duke/Ui.java @@ -8,6 +8,11 @@ public class Ui { private Scanner in; + /** + * Creates a new instance of scanner + * + * returns userInput + */ public Ui() { this.in = new Scanner(System.in); } @@ -17,11 +22,7 @@ public Ui() { * @return user input */ public String readCommand(){ - String userInput = null; - if(in.hasNextLine()) { - userInput = in.nextLine(); - } - return userInput; + return in.nextLine(); } /**