This commit is contained in:
xixu-me committed 2024-04-22 23:44:03 +08:00
1 parent 67e31dba87
commit 4b00d5838c
2 files changed
+5 -4

No files matched your search

+4 -3
View File
@@ -11,7 +11,7 @@ public class Test {
Scanner sc = new Scanner(System.in);
while (continueBuy) {
System.out.print("Please enter your name: ");
name = sc.next();
name = sc.nextLine();
System.out.print("Please enter your payment: ");
payment = sc.nextInt();
Thread consumer = new Thread(ts, name + "-" + payment);
@@ -22,8 +22,9 @@ public class Test {
e.printStackTrace();
}
System.out.println("Do you want to continue buying tickets? Y: Yes, N: No");
continueBuy = sc.next().equalsIgnoreCase("Y");
continueBuy = "Y".equalsIgnoreCase(sc.next());
sc.nextLine();
}
sc.close();
}
}
}