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(); } /**