开发者

Palindrome in Java with NUmbers [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 6 years ago.

Improve this question

I am self studying java, i am on开发者_开发百科 while loops already, I have an exercise here regarding a palindrome. what's a palindrome? how will code it? any ideas? or pseudocode for it? I am really confused here

NOT a HOMEWORK


Since its not homework, it shouldn't matter how you implement it.

public static <ToStringable> boolean isPalindrome(ToStringable stringable) {
    String text = stringable.toString();
    return text.equals(new StringBuilder(text).reverse().toString());
}


A palindrome is a sequence that reads the same backwards as forwards, like "kayak" or 12321.

See here: http://en.wikipedia.org/wiki/Palindrome

EDIT: there are also lots of questions about palindromes on stackoverflow already. Browse through them and come back if you have more specific questions:

https://stackoverflow.com/questions/tagged/palindrome


Palindrome is a sequence such that reversing the sequence gives you the same sequence. E.g. MAM

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜