Hello guys!!!
I'm new to java programming!
Just started last semester.
Help me in the places I have Ariel black
String P, // Ignore these set of codes.. I know what's happening here.
str;
int i;
Scanner keyboard = new Scanner(System.in);
System.out.print("Enter a Word: ");
P = keyboard.nextLine();
// I'm looking at the sample code and didn't get these line of code.
int n = P.length(); // Does the variable n stands for the length of
// user's input?
str = ""; // why is str set to blank?
for (i = n - 1; i >= 0; i--) // I don't get this loop
str = str + P.charAt(i); // and this
if (str.equals(P)) // and this line of code.
System.out.println(P + " is palindrome");
else
System.out.println(P + " is not a palindrome");
Thank you!!!!!
This post has been edited by blackcompe: 04 February 2012 - 06:09 PM
Reason for edit:: Please use [code] tags when posting to the forum.

New Topic/Question
Reply



MultiQuote




|