Hi,
I was asked if I could explain the following code. I've never looked at Java before or even used rentacoder so would really appreciate some help.
See below for code. If i'm bit vague on any of the points please e-mail me
Thanks
CHRIS
P.S not to insult anyone's intelligence but a palindrome is a word spelt the same fward as backward i.e. mum or dad.
## Deliverables
class Palindrome {
public static void main( String [] args) {
char [] c = args[0].toCharArray();
char [] r = reverse( c);
if (equals( c, r)) {
[login to view URL]( "The string \"" + args[0] + "\" is a palindrome.\n"); }
else {
[login to view URL]( "The string \"" + args[0] + "\" is not a palindrome.\n"); } }
private static char [] reverse( char [] c) {
char [] r = new char[ [login to view URL]];
for ( int i=0; i < [login to view URL]; i++) {
r[i] = c[ [login to view URL] - (i + 1)]; };
return r; }
private static boolean equals( char [] c1, char [] c2) {
boolean result = [login to view URL] == [login to view URL];
if (result) {
for (int i = 0; i < [login to view URL]; i++) {
if (c1[i] != c2[i]) {
result = false; } };
return result; }
else {
return false; } }
}
I would like a detailed description of this code in a MS Word 2000 Document so if I had to explain what this code means I could. Explaining what each line of the above code means. Please note that the code has been attached as a zip file and in the deliverables. I need the description of this code by 2moro.
## Platform
Doesn't need to run on any system must be entered in a Microsoft Word 2000 document.