From 7f702254cae840e2a5ef2a6d65ec8dcab0303ccb Mon Sep 17 00:00:00 2001 From: staresgroup Date: Mon, 2 Sep 2019 21:37:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=BE=AA=E7=8E=AF=E9=98=9F?= =?UTF-8?q?=E5=88=97=E9=81=8D=E5=8E=86for=E5=BE=AA=E7=8E=AF=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- java/09_queue/CircularQueue.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/09_queue/CircularQueue.java b/java/09_queue/CircularQueue.java index 71a988c..e65313f 100644 --- a/java/09_queue/CircularQueue.java +++ b/java/09_queue/CircularQueue.java @@ -37,7 +37,7 @@ public class CircularQueue { public void printAll() { if (0 == n) return; - for (int i = head; i % n != tail; ++i) { + for (int i = head; i % n != tail; i = (i + 1) % n) { System.out.print(items[i] + " "); } System.out.println();