From 29c5da3500e212035047e00293a7efa1a2f773eb Mon Sep 17 00:00:00 2001 From: Fluffy-debuger <115883267+Fluffy-debuger@users.noreply.github.com> Date: Sun, 23 Oct 2022 08:57:53 +0530 Subject: [PATCH] Create Code to check whether a given string is palindrome or not --- ...hether a given string is palindrome or not | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Code to check whether a given string is palindrome or not diff --git a/Code to check whether a given string is palindrome or not b/Code to check whether a given string is palindrome or not new file mode 100644 index 0000000..8476dc0 --- /dev/null +++ b/Code to check whether a given string is palindrome or not @@ -0,0 +1,24 @@ +import java.util.Scanner; +public class String_Palindrome { +static void check_palindrome(String b,String in) +{ + boolean x=in.equals(b); + if(x) + { + System.out.println("Given String is a Palindrome"); + } + else + { + System.out.println("Given String is not a Palindrome"); + } +} +public static void main(String[] args) { + Scanner n = new Scanner(System.in); + System.out.print("Enter Your String :"); + String s= n.nextLine(); + StringBuffer sn= new StringBuffer(s); + StringBuffer t=sn.reverse(); + String a= t.toString(); + check_palindrome(a,s); + } +}