From 7e80ee968d36ea7e8c310a03d1445382d050aa25 Mon Sep 17 00:00:00 2001 From: 007cody Date: Thu, 30 Jan 2025 10:12:16 -0800 Subject: [PATCH] Update PalindromeChecker.java --- src/main/java/PalindromeChecker.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/PalindromeChecker.java b/src/main/java/PalindromeChecker.java index 76e13c8..5871cb3 100644 --- a/src/main/java/PalindromeChecker.java +++ b/src/main/java/PalindromeChecker.java @@ -48,10 +48,10 @@ public boolean palindrome(String word) } public String reverse(String str) { - String sNew = new String(); - for (int i=str.length(); i>0; i--){ - sNew = sNew + str.substring(i-1,i); + String output = new String (""); + for (int i=str.length(); i>0; i--){ + output = output + str.substring(i-1,i); } - return sNew; + return output; } }