0% found this document useful (0 votes)
3 views2 pages

Java

The document contains a Java class named FuncStrPalin that checks if a given string is a palindrome. It uses a StringBuilder to reverse the input string and compares it to the original string, ignoring case. The main method handles user input, checks for empty strings, and prints whether the input is a palindrome or not, while also handling exceptions.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Java

The document contains a Java class named FuncStrPalin that checks if a given string is a palindrome. It uses a StringBuilder to reverse the input string and compares it to the original string, ignoring case. The main method handles user input, checks for empty strings, and prints whether the input is a palindrome or not, while also handling exceptions.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Import [Link].

*;

Public class FuncStrPalin

Boolean isPalinStr(String str)

StringBuilder rev = new StringBuilder();

For(int I = [Link]() – 1; I >= 0; i--)

[Link]([Link](i));

Return [Link]([Link]());

Public static void main(String[] args)

Scanner sc = new Scanner([Link]);

Try

[Link](“Enter the string: “);

String str = [Link]();

If([Link]().isEmpty())

Throw new Exception(“Input cannot be empty”);

}
FuncStrPalin obj = new FuncStrPalin();

Boolean result = [Link](str);

[Link](result ? “Palindrome String” : “Not Palindrome


String”);

Catch(Exception e)

[Link](“Error: “ + [Link]());

You might also like