java palindrome

String Reverse Java

There is no straight way to reverse a string in Java. reverse() method is not included in String class as String is immutable. We use reverse() method of StringBuffer class to reverse a string. In the following code, string palindrome is checked with string reverse.

Output screen on String…

Palindrome Delete Replace Reverse Java Example

Note: Palindrome Example is available in second page. 1. Deleting the Characters To delete characters from StringBuffer, two methods exist – deleteCharAt() and delete(). Supported methods from String class StringBuffer deleteCharAt(int pos): Delete the character in the StringBuffer at the specified index number, pos. StringBuffer delete(int start, int end): Deletes…