Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Write the code for Palindrome ?

Answers were Sorted based on User's Feedback



Write the code for Palindrome ?..

Answer / aslam

public boolean isPaliandrome(String txtToCheck){

StringBuffer strb1 = new StringBuffer(txtToCheck).reverse();
if(txtToCheck.equals(strb1.toString()))
return true;
return false;

}

Is This Answer Correct ?    5 Yes 4 No

Write the code for Palindrome ?..

Answer / suresh royal

mport java.io.*;

public class Palindrome {
public static void main(String [] args){
try{
BufferedReader object = new BufferedReader(
new InputStreamReader(System.in));
System.out.println("Enter number");
int num= Integer.parseInt(object.readLine());
int n = num;
int rev=0;
System.out.println("Number: ");
System.out.println(" "+ num);
for (int i=0; i<=num; i++){
int r=num%10;
num=num/10;
rev=rev*10+r;
i=0;
}
System.out.println("After reversing the number: "+ " ");
System.out.println(" "+ rev);
if(n == rev){
System.out.print("Number is palindrome!");
}
else{
System.out.println("Number is not palindrome!");
}
}
catch(Exception e){
System.out.println("Out of range!");
}
}
}

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More Core Java Interview Questions

How can you read content from file in java?

0 Answers   HCL,


How to convert string to char and vice versa?

0 Answers  


What is ctrl m character?

0 Answers  


Describe OOP in java?

2 Answers   Syntel,


What an i/o filter in java programming?

0 Answers  


Explain java code for recursive solution's base case?

0 Answers  


watz the difference between abstract class and interface? Which one u ill choose as a designer?

1 Answers   Sonata,


How can you share data between two thread in Java?

0 Answers  


Differences between jdk 1.4 and 1.5

6 Answers   SoftSol, TCS, Wipro,


What is a JAR file?

0 Answers  


Write a program that takes a 5 digit number and calculates 2 power that number and prints it.

1 Answers  


What is the importance of finally block in exception handling?

0 Answers  


Categories