Today I thought I had better get back to doing some Java programming. The section I just revised concerned Strings. No, not the things cats chase if you dangle it in front of them, but Java Strings – strings of text like “Hello World”.

There were a couple of examples given where you could reverse a String – flip it round back-to-front. But did you know there are some words or phrases that read the same whether you reverse them or not? These are palindromes.

For instance, some examples of one-word palindromes are:

“racecar”, “refer”, “level”, “radar”, “civic” .

Whole phrases can also be palindromes. For example,

 “Madam, I’m Adam”

“Doc, note: I dissent. A fast never prevents a fatness. I diet on cod”

“Was it a car or a cat I saw?”

“A Toyota’s a Toyota”

… and my personal favourite,

“A man, a plan, a canal – Panama!”

P.S. The above phrases only work as palindromes if you ignore capital letters, spaces and punctuations. But some palindromes work if you count the spacing:

“Rats live on no evil star”

“Step on no pets”


Leave a comment

Filed under Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s