I hope this code could help you....
Bye,
Mike
_______________________________________________________________________
public class Main {
protected static String reverse(String string)
{
StringBuffer sb = new StringBuffer(string);
return sb.reverse().toString();
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
String word = "tom";
System.out.println("Original word: " + word);
System.out.println("Inverted word: " + reverse(word));
}
}
___________________________________________________________________________
--------- Original Message --------
Da: [email protected]
To: Free Java Programming Online Training Course By Sang Shin
<[email protected]>
Oggetto: [java programming] PALINDROME
Data: 22/02/09 17:42
>
>
>
>
> I am curious about palindrome, how to change a word :
>
> Franz
>
> and then the word become :
>
> znarF
>
> My java code is :
>
> class ArrVal
> {
> public static void main (String[] args)
> {
> char value[] = {'F','r','a','n','z'};
> System.out.print("the original word :" + 'n');
> System.out.print(value[0]);
> System.out.print(value[1]);
> System.out.print(value[2]);
> System.out.print(value[3]);
> System.out.println(value[4]);
> System.out.print("the word would be :" + 'n');
> System.out.print(value[4]);
> System.out.print(value[3]);
> System.out.print(value[2]);
> System.out.print(value[1]);
> System.out.println(value[0]);
> System.out.println("Dimension array size is : " + value.length);
> }
> }
>
>
----------------------------------------------------------------------------------------------------
> The output program is :
>
> the original word :
> Franz
> the word would be :
> znarF
> Dimension array size is : 5
>
----------------------------------------------------------------------------------------------------
>
> My question :
>
> 1. Is there another way to change a word without accessing a character
> of array one by one to show it??
> 2. Is it possible create it in a String object?? how anybody give me
> java snippet please??
>
> somebody help me please??
>
> >
>
>
>
--
Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP
autenticato? GRATIS solo con Email.it: http://www.email.it/f
Sponsor:
Prova il servizio di Email Marketing di Email.it, incrementi la visibilita'
della tua azienda e trovi nuovi clienti.
Liste a partire da 10.000 contatti per soli 250 Euro
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=8351&d=20090222
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---