From 5b6fb34a82e071871025a64462da35eb8f21c6ac Mon Sep 17 00:00:00 2001 From: selear Date: Tue, 21 Nov 2023 21:20:04 +0800 Subject: [PATCH] fix: Use .equals() to compare two strings in Java (#961) --- codes/java/chapter_tree/array_binary_tree.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/codes/java/chapter_tree/array_binary_tree.java b/codes/java/chapter_tree/array_binary_tree.java index 029b1b0c4..a1f3fa865 100644 --- a/codes/java/chapter_tree/array_binary_tree.java +++ b/codes/java/chapter_tree/array_binary_tree.java @@ -63,15 +63,15 @@ class ArrayBinaryTree { if (val(i) == null) return; // 前序遍历 - if (order == "pre") + if ("pre".equals(order)) res.add(val(i)); dfs(left(i), order, res); // 中序遍历 - if (order == "in") + if ("in".equals(order)) res.add(val(i)); dfs(right(i), order, res); // 后序遍历 - if (order == "post") + if ("post".equals(order)) res.add(val(i)); }