write program for palindrome

Answer Posted / baskaran

import java.io.*;

class Polindrome1{

public static void main(String args[])
throws IOException{

String s,p;
BufferedReader obj1=new BufferedReader(new
InputStreamReader(System.in));
s=obj1.readLine();
System.out.println("Input Value:"+s);
p=new StringBuffer(s).reverse().toString();
if(s.equals(p)){
System.out.println("This Input Is
Polindrome:"+s);}
else
System.out.println("The Input Value Is Not
Polindrome");

}

}

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to access a variable of the structure?

771


What is an arraylist c++?

899


How is modularity introduced in C++?

938


What is a driver program?

846


What is binary object model?

766


Incase of a function declaration, what is extern means?

718


How do you define a class in c++?

822


If you push the numbers (in order) 1, 3, and 5 onto a stack, which pops out first a) 1 b) 5 c) 3

1080


What should main() return in c and c++?

742


Why namespace is used in c++?

783


What function initalizes variables in a class: a) Destructor b) Constitutor c) Constructor

898


What does count ++ do in c++?

924


What is a storage class? Mention the storage classes in c++.

778


the maximum length of a character constant can be a) 2 b) 1 c) 8

873


Can we use this pointer inside static member function?

829