Comment

Anantha Narayanan
String Palindrome.,
February 21, 2010 at 1:04 PM

I am new to java. I started learning just a week ago.
I wrote one small String palindrome.Whether it is correct.
package stringpalindrome;
import java.io.*;
import java.lang.*;


/**
*
* @author god
*/
public class StringPalindrome {

/**
* @param args the command line arguments
*/

public static void main(String[] args) {
// TODO code application logic here
String arc = "anna";
boolean palin;
char an,na;
String ab,ac;

int bk = arc.length()-1;
for(int i = 0;i<=arc.length()-1;++i){
an = arc.charAt(i);
na = arc.charAt(bk);
bk = bk - 1;
ab = java.lang.Character.toString(an);
ac = java.lang.Character.toString(na);

if(ab.equals(ac)){
if(i==arc.length()-1){
System.out.println("It is a Palindrome");
}
}else
{
System.out.println("It is not a Palindrome");
break;
}

}



}

}
View All Comments | View Tutorial
Related Tutorial and Articles
Java Beginners

java palindrome
java palindrome  sir i need java program to print 1)integer palindrome 2)string palindrome 

Java Beginners

palindrome - Java Beginners
palindrome  example of java program if it is a palindrome...;For String : public class Palindrome { public static void main(String[] args) { String str1 = "eye", str2 = "bye"; System.out.println("Palindrome 

Java Beginners

palindrome - Java Beginners
+ " is not a palindrome"); } } } For more information on Java... is palindrome. A word is said to be palindrome if it reads the same forward... to input a string and then output the results as follows. Enter a word: noon 

Java Beginners

palindrome - Java Beginners
palindrome  determines whether or not it is a palindrome. if the number is not five... == digit4)){ System.out.print("Number is palindrome!"); } else{ System.out.println("Number is not palindrome!"); } } catch(Exception e   

Java Beginners

palindrome - Java Beginners
palindrome in java code  I need an example of palindrome in Java ... void main(String [] args){ try{ BufferedReader object = new BufferedReader...;& (digit2 == digit4)){ System.out.print("Number is palindrome!" 

Java Beginners

complete the code (palindrome) - Java Beginners
java.util.Scanner; public class Palindrome { public static void main(String[] args... class Palindrome { private String pal; public Palindrome(String... and last letters are different // so the string is not a Palindrome. return 

Java Beginners

palindrome - Java Beginners
palindrome  Write a program to find whether a given string is a palindrome or not  Hi Friend, Try the following code: import java.util.*; public class CheckPalindrome{ public static void main(String[] args 

Java Beginners

palindrome - Java Beginners
palindrome  import java.io.*; class Palindrome... InputReaderStream(System.in)); String word; word=br.readLine(); public static void main(String[]args) { int left = 0; int right 

Java Beginners

To find palindrome no in a file - Java Beginners
To find palindrome no in a file  hi all i am having a problem...I wanted to write one java program where i have to count the no of palindrome...; public static boolean isPalindrome (String s) { int low, high; low = 0 

Java Beginners

String to Date Conversion - Java Beginners
)); For read more information : http://www.roseindia.net/java/java-conversion...String to Date Conversion  Hi , I am retreiving time stamp of a file and then inserting it into ACCESS DB. I am converting it to string format 

Java Beginners

HSSFCell to String type conversion
HSSFCell to String type conversion  Hello, Can anyone help me convert HSSFCell type to string. There is a solution in the following URL...://www.roseindia.net/tutorial/java/poi/readExcelFile.html 

Java Tips and Examples

Java Program to check Palindrome
Java Program to check Palindrome In this section, you will learn about palindrome in java and how to check any number that is palindrome or not. First of all what is palindrome number?, this is the number that the original number 

Java-Tutorials

Palindrome program in Java
Palindrome program in Java helps programmers to determine if a number or string is palindrome or not. palindrome number or string remains unchanged when.... The logic used in Java program behind finding a number or sting is palindrome 

Java Beginners

java conversion
java conversion  how do i convert String date="Aug 31, 2012 19:23:17.907339000 IST" to long value 

Java Beginners

palindrome
palindrome  how to write in string of palindrome?   import java.util.*; public class CheckPalindrome{ public static void main(String... is palindrome"); } else{ System.out.println("String 

Java Beginners

palindrome
palindrome  how to write in string of palindrome   import java.util.*; public class CheckPalindrome{ public static void main(String... is palindrome"); } else{ System.out.println("String 

Java Beginners

palindrome
palindrome  program to find the given string is palindrome...]; } if(st.equalsIgnoreCase(reversedSt)){ System.out.println("String is palindrome"); } else{ System.out.println("String is not palindrome 

General

The Array Palindrome Number in Java
The Array Palindrome Number in Java       This is a Java simple palindrome number program. In this section you will read how to uses palindrome one dimensional array 

Java Beginners

PALINDROME
PALINDROME  how to find palindrome of a number WITHOUT using a string...*; public class NumberPalindrome { public static void main(String [] args){ try{ Scanner... == reversedNumber){ System.out.print("Number is palindrome!"); } else 

Development process Questions

java code for conversion of arraylist to string - Development process
java code for conversion of arraylist to string  Hi, i have... into seperation.fo that i want to convert into string, after that split the string... : import java.util.*; class ArrayListToString { public static void main(String 

Java Beginners

Type Conversion - Java Beginners
from integer value to a string value .In a database operation i want to convert it.   hi jagadish Suppose int num = 10; String id = ""+num... for conversion 

Java Beginners

Distance conversion - Java Beginners
Distance conversion  Write an application that reads a distance in metres. The program will then present a user menu of conversion types, converting... static void main(String[]args){ ConvertMeter convert=new ConvertMeter 

Java-Tutorials

Java char to string
Following program will show you how to convert a char into a string in Java... of any white space. Example of converting Java char to string: package Roseindia... CharToString { public static void main(String args[]) throws IOException 

Java Beginners

Program to display palindrome numbers between some range
Program to display palindrome numbers between some range  Hi!I want a java program to display palindrome numbers between 100 to 1000.can you please...); String number=in.toString(); int index1=0 

Java Beginners

conversion - Java Beginners
; public class ConvertXLSToPDF { public static void main( String [] args ) { String fileName="C:\\excelFile.xls"; Vector dataHolder... Vector ConvertXLSToPDF(String fileName){ Vector cellVectorHolder = new 

Java Beginners

Finding all palindrome prime numbers - Java Beginners
Finding all palindrome prime numbers  How do i write a program to Find all palindrome prime numbers between two integers supplied as input (start and end points are excluded 

Java Interview Questions

Conversion In Collections - Java Interview Questions
Conversion In Collections  Hi Friends, can u give code to convert...*; import java.lang.reflect.*; class Data{ private int key; String value; public Data(){} public Data(int key, String value) { super(); this.key = key 

Java Tips and Examples

Palindrome Number Example in Java
Palindrome Number Example in Java    ... the palindrome number and how to determine any number is palindrome or not. First of all we are going to read about the palindrome number.  This is the number 

Java Beginners

Another distance conversion - Java Beginners
a method for each conversion ? toKilometres(), toFeet(), and toInches...; return inchValue; } public static void main(String args... InputStreamReader(System.in)); String distance=null; try{ distance 

Java-Tutorials

Java : String Case Conversion
Java : String Case Conversion In this section we will discuss how to convert a String from one case into another case. Upper to Lower case Conversion... into lower case char/String. Lower to Upper case Conversion : By using toUpperCase 

Date Calendar

Java Date conversion - Date Calendar
Java Date conversion  How do I convert 'Mon Mar 28 00:00:00 IST 1983' which is a java.util.Date or String to yyyy/MM/dd date format in sql 

Core Java

String to Int Conversion
String to Int Conversion       This section illustrates you how to convert a string into its integer equivalent. To demonstrate the conversion of string into an integer we are taking 

Java Beginners

object conversion - Java Beginners
/java-conversion/ObjectToDouble.shtml Thanks... sandeep kumar suman...object conversion   Hi, Can anybody tell me the object conversion in java.   Hi sandeep Can u please tell me in details about your 

Applet Questions

conversion Applet
conversion Applet  I am a java beginner.................. strong texthow to create JApplet that prompts the user to enter a distance in miles in a JTextField and then converts mile to kilometers and display the result as XX.XX 

Java Beginners

Java Conversion Question - Java Beginners
Java Conversion Question   Hello sir ,How i can Convert Java Code to Vb.net ,Plz Help Me 

Java Beginners

conversion
conversion  please give me the code to convert the particular string "messageType=3+sourceSystemId=0+destinationSystemId=0+NPA=1+prefix=0+phoneNumber=0+length=0+subLength=209+subCode=49+subType=1+subResult=0+subCause=0 

Java Beginners

conversion
conversion  please give me the code to convert the particular string "messageType=3+sourceSystemId=0+destinationSystemId=0+NPA=1+ prefix=0+phoneNumber=0+length=0+subLength=209+subCode=49+subType=1+ subResult=0+subCause=0 

Core Java Tutorials

Conversion from String to char
Conversion from String to char: In this tutorial we will learn how to convert a string type data to char type data. Description: This program will take...(buffreader.readLine()); String mystring = "Welcome to Java"; Character 

Java Beginners

String conversion
String conversion  I want to convert a string of mix cases(lower and upper case) to vice versa. ex. HellO should be printed to hELLo. the string comes from user using datainputstream. Also sending individual chars of string 

Java Beginners

html2xml conversion
html2xml conversion  java code to convert html file to xml 

Java Beginners

Language Conversion
Language Conversion  write a java program to convert "Hello World" in spanish 

Java Beginners

image conversion tools
image conversion tools  how many tools are available in image conversion at particularlly in java 

UML Questions

hexadecimal conversion java compilation - UML
hexadecimal conversion java compilation  write a simple program..., Please visit the following links: http://www.roseindia.net/java/java-conversion/BinaryToHexa.shtml http://www.roseindia.net/java/java-conversion 

Java Beginners

To check a palindrome number?
To check a palindrome number?  program to check a number is palindrome or not using recursion?(wihout converting to string 

Java Beginners

form to java script conversion
form to java script conversion  I am using a form one more form cotain a piece of code . how to convert it to java script to function it properly? code is shown below <form action="http://www.google.com" id="cse-search 

Java Beginners

ascii to thai language conversion - Java Beginners
ascii to thai language conversion  I have a string in ascii format like \u0042\u00072 ..., It was converted from thai language. How can i convert it to thai language. I would be more thankful if I get some example or some 

Java Beginners

string - Java Beginners
string  WAP to enter a sentence & print the no. of palindrome words... java.util.*; class CountPalindromes{ public static void main(String[] args){ int... sentence: "); String str=input.nextLine(); StringTokenizer stk=new 

Java Beginners

Excel conversion tool. - Java Beginners
Excel conversion tool.  Hi, I need a conversion tool which can convert .xls(Excel 2003) to .xlsx (Excel 2007) and vice-versa. Please suggest any links ro tools. Thank You 

General

Java Date Conversion
Java Date Conversion In java date conversion, two packages are used... Java Converts String into Date In this example we are going to convert...; Java Converts String into Calendar In this example we 

Java Technology Tutorials

Java date to String, Convert date object into a string with a pattern
Convert date object into a string with a pattern This section illustrates you the conversion of date object into a string pattern. Java has provide many... string. For example, d -  denotes the day in month M- denotes the month 

Java Beginners

Java To Vb.Net Conversion - Java Beginners
Java To Vb.Net Conversion  How to convert Java Code To VB.net,which Software is useful to convert java to vb.net,plz Help Me 

Java Beginners

String
String  How to Convert sunnapu gopal to Sunnapu Gopal in java using String 

Java Beginners

string
string  java prgm to find total occurence of a given string pattern in a sentence 

Java Beginners

string
string  java prgm to find total occurence of a given string pattern in a sentence 

Java Beginners

string
string   difference detween "public static void main (String[] args) " and "public static void main (String args[])" in java but it executes both ,in java which one is legal   The only difference is style, where 

Java Beginners

string
string  a java program using string function that computes your... links: http://www.roseindia.net/tutorial/java/core/printInitials.html http://www.roseindia.net/answers/viewqa/Java-Beginners/13383-print-initials.html 

Java Beginners

string
string  how we conunt the no. of words in java without using in pre defined method in java 

Development process Questions

Conversion - Development process
Conversion  Why is there a need to convert from Java to .NET? What is the theory of conversion from java to .NET? How it is done?   Hi... Conversion Assistant (JLCA). Code that calls Java APIs can convert to comparable C# code 

Java Beginners

string
string  a java program using string function to input any string... ArrangeStringAlphabetically { public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.print("Enter string 

Java Beginners

string
string  a java program to replace all matching substrings 

Java Beginners

string
and also displaying that contain word? Like I want to find "a" in the string "This is example of java Programme" and also display word that contain "a" character.   Here is a java example that accepts a sentence from the user 

Java Beginners

string
string  how do i extract words from strings in java???   Hi... ExtractWords { public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.print("Enter String 

Java Beginners

string
string  a java program to input a string and display the string...*; import java.io.*; public class FirstLetter{ public static String capitalizeFirstLetter( String str ) { final StringTokenizer st = new StringTokenizer( str 

Java Beginners

string
string  program for String reverse and replace in c,c++,java e.g.Input:10,20,hello output:hello;20;10   Hi Friend, Try the following java...(String[] args) { String array[]=new String[5]; Scanner input 

Java Beginners

string
string  a java program using string function and access modifiers to automate the insurance company which will have to manage the information about policy holders Data Members: 1)Policy No 2)Name of policy holder 3)Address 4 

Java Beginners

Palindrome
Palindrome  program to verify palindrome 

Java Beginners

PDF to Word Conversion - Java Beginners
PDF to Word Conversion  Hello, Can we convert a PDF document to Microsoft word document thru Java. If its not possible in Java, is it possible in any other language 

JavaScript Questions

javascript integer to string conversion
javascript integer to string conversion  How to Javascript Integer to String Conversion   <script type="text/javascript">..., this works result = a + b + c; printWithType(result); //123 string 

Java Beginners

Conversion of String to Integer
Conversion of String to Integer  public class Test { public static void main(String[] args) { int countA = 0; int countB = 0...'; chr++) { (int) String "count"+chr = 0 

Java Beginners

how to write a function to print for finding the longest palindrome in the given string
how to write a function to print for finding the longest palindrome in the given string  how to write a function to print for finding the longest palindrome in the given string 

Java-Tutorials

Java char to string
There are many ways to convert a char into a string in Java, one of them...); System.out.println("String value is " + s1); } } Output: C:\corejava>java CharToString Enter a Character: P Character value is P String value is P C 

General

Java Conversion
Java Conversion      ... you the conversion of double into string. Convert ArrayList to Array... for this conversion. Convert Boolean to String In this section, we are going 

Development process Questions

palindrome
palindrome  write a program to print palindrome numbers between 500 to 700 

Java Beginners

Reports to pdf conversion
Reports to pdf conversion  I need to convert reports into pdf format using java.. Will i get any sample code 

Java Tips and Examples

Convert Double To String
; This section learns you the conversion of double into string. The following program... this program.  C:\corejava>java DoubleToString string:=100.0... Convert Double To String       

Java Beginners

pdf to xml conversion
pdf to xml conversion  i want to convert pdf file into xml file.. where i am having a table in pdf file with some headers and some data into it. i want the headers to be the tag of xml file. how can i do that using java? please 

Core Java

Java integer to string
Java integer to string      ... on the value in its string form. Converting numeric values to Strings with Java...:/www.roseindia.net/java/java-conversion/IntegerToString.shtml http:/www.roseindia.net 

Java-Tutorials

Java String To Date
be convert into java.util.Date. Java string to date convert explains the conversion of Java string written into the specified format to a Java date object...Java String To Date In this section you will read about how to convert 

Java Interview Questions

Java string
Java string  Strings are immutable.But String s="Hello"; String s1=s+"World"; S.O.P(s1); means printing "Hello World". How 

Java Beginners

Conversion from color to Gray Image - Java Beginners
Conversion from color to Gray Image  Hi... Sakthi here.. i am new to java. and i haven't try this so far How to convert the color image to gray scale image in java? could u plz help me out to start the process 

Java Beginners

Java String
Java String  You are given two strings S1 and S2,Delete from S2 all those characters which occur in s1 also and create a clean S2 with the relevant characters deleted..write a pgm for this..pls send as soon as possible Thank you 

Java Tips and Examples

Convert Character into a String
of this program. C:\corejava>java CharToString Enter a Character... Convert Character into a String   ... to convert a char into a string type data. The java.lang package provides 

Java Tips and Examples

Convert String into long in java
Convert String into long in java In this section you will learn about conversion of numeric type String data into long in java. Converting string to long is similar to converting string to int in java, if you convert string to integer 

Java Code Examples

Check whether the number is palindrome or not
Check whether the number is palindrome or not A palindrome is a word, phrase... is palindrome or not. You can check it in various ways but the simplest method...*; public class NumberPalindrome { public static void main(String[] args 

Java Tips and Examples

Conversion of Decimal to Binary in Java
Conversion of Decimal to Binary  in Java In this section we will discuss about conversion of Decimal to Binary in Java. You know that number having.... Now here is the code for conversion.  class Conversion { public static 

Java Technology Tutorials

Java convert string to InputStream
Java convert string to InputStream In this section, you will learn how to convert string to Inputstream. In one of the previous sections, we have discussed the conversion of InputStream to string. Here we are going to do just reverse 

Java Beginners

java
is palindrome"); } else{ System.out.println("String is not palindrome...java  hello,i am learning java from past 1 month,i learnt till the inheritance & i want to write a program to test weather a given string 

Java Beginners

Java String - Java Beginners
Java String  How to seperate the string into characters.  there is a method called getChars() in String class,plz use that and separate into characters so plz verify the String api for related questions  

Java Beginners

String in Java - Java Beginners
]); } } } ---------------------------------------------------- I am sending simple code of String array. If you are beginner in java...String in Java  hiiiii i initialise a String array,str[] with a size... in advance   Hello Antony Insted Using String Array Use StringBuffer 

Java Beginners

How to convert a String to an int?
of data conversion in Java. Thanks...How to convert a String to an int?  I my program I am taking the input from user from a HTML form in JSP page. The value retrieved is in the String 

Java Tips and Examples

Converting object to String
to String in java. It is sometimes necessary to convert object to String... of  java.lang package. Java provide two method to convert to string... is used, a static method provided by java to convert to String. Example : Code 

Java Beginners

string - Java Beginners
string in java interview questions  What is string in java? Interview questions 

Development process Questions

Java code for conversion between .xls and .xlsx or vice versa - Development process
Java code for conversion between .xls and .xlsx or vice versa  I've some problems in my Project. I'm working on a web based application which... or tool in Java for converting between .xls to .xlsx or Vice versa 

Struts Questions

jsp to struts 2 action conversion problem - Struts
jsp to struts 2 action conversion problem  i have one jsp page that includes 3 other jsp pages(using RequestDispactcher).how to convert that jsp...(i.e no java code is involved).remaining pages involve java code.  Hi 

Core Java

Java String
Java String       In this section, you will learn about the java string. Java String is a set... to a string literal in the object stream. The Java String object contains a sequence 

Java Interview Questions

Java string buffer
Java string buffer  what is stringBuffer and StringBuilder 

Java Beginners

How to convert into to String in Java?
How to convert into to String in Java?  Hi, How to convert into to String in Java? Thanks 

Core Java Tutorials

Data Conversion from String to another type
Data conversion is the conversion of data from one type to another type. In this section we will learn about data conversion from String primitive type to another data type like int, boolean and char etc 

Java Beginners

How to split string in Java?
How to split string in Java?  Hi, I have a string seperated by ',' comma. How to split the string? Thanks 

Java Beginners

String immutable - Java Beginners
String immutable  Why is String immutable?  See here Why String is immutable in Java 

Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles