A Program to check String is Palindrome or not. Program to reverse a string in Java Programming Language.
A Program to check String is Palindrome or not. Program to reverse a string in Java Programming Language.
The Methods used are:
charAt(), length().
The String is given as input in the program. The length of the string is counted using length() method. for() loop has been used which contains the condition where the last alphabet is taken. Return String In the package Stores the last alphabet and prints it .
charAt() method returns char value at given index number.
In the end, the original String passed and the reversed string is compared and the output is displayed whether the program is palindrome or not.
The advantage of this package is :
It can skip the spaces in the String passed as input with replace() method.
Submitted by Ashlesha Laxman Aher (ashleshaaher)
Download packets of source code on Coders Packet
Comments