浏览代码

update console with nextline instead of next

Jonathan Hinds 6 年前
父节点
当前提交
d8a9e8abcb
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2
    2
      src/main/java/io/zipcoder/casino/Console.java

+ 2
- 2
src/main/java/io/zipcoder/casino/Console.java 查看文件

@@ -14,7 +14,7 @@ public class Console {
14 14
     public void createAccount()
15 15
     {
16 16
         System.out.println("Hello, what is your name?");
17
-        String name = scanner.next();
17
+        String name = scanner.nextLine();
18 18
 
19 19
         System.out.println("How much money are you bringing to the table?");
20 20
         int balance = getIntFromUser();
@@ -99,7 +99,7 @@ public class Console {
99 99
 
100 100
     public String getCommand() {
101 101
         String command = "";
102
-        String input = scanner.next();
102
+        String input = scanner.nextLine();
103 103
         input = input.toLowerCase().trim();
104 104
 
105 105
         for(String name : gameLib){