Palindromes

Reply

Join Date: Aug 2006
Posts: 137
Reputation: PoovenM is on a distinguished road 
Solved Threads: 11
PoovenM PoovenM is offline Offline
Junior Poster

Re: Palindromes

 
0
  #11
Dec 18th, 2008
When I said, 'Where ... refers to the code after the line String s = inFile.readLine();' I meant all of the code. A loop will allow for a set of instructions to be executed 0, 1 or more times. If all you want to repeat is reading the data from the file, then that leaves you with only processing the last line of the file.

You need to read in the data and process it and that's what needs to be repeated and thus placed in a loop.

Anyway, what do you mean by, 'at the start of my boolean?' Please use the [code=java] so line numbers appear. That way you can tell us which line the error occurred. The expression in the while loop is not incorrect and would compile.

Regardless, by looking at your code I can see that you're missing some braces. Particularly, you don't close the for loop nor do you close the main method. This is why you're getting the error.
Last edited by PoovenM; Dec 18th, 2008 at 9:49 am.
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 1,648
Reputation: javaAddict is a name known to all javaAddict is a name known to all javaAddict is a name known to all javaAddict is a name known to all javaAddict is a name known to all javaAddict is a name known to all 
Solved Threads: 223
Featured Poster
javaAddict's Avatar
javaAddict javaAddict is offline Offline
Posting Virtuoso

Re: Palindromes

 
0
  #12
Dec 18th, 2008
First of all:
Next time post what kind of error you get and where you get it so we wouldn't have to search the entire code for the error.

And second:

This:
  1. public static boolean isPalindrome(s) {
  2.  
  3. }

should be:

  1. public static boolean isPalindrome(String s) {
  2.  
  3. }
Last edited by javaAddict; Dec 18th, 2008 at 10:02 am.
Check out my New Bike at my Public Profile at the "About Me" tab
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 1,563
Reputation: BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all 
Solved Threads: 196
BestJewSinceJC BestJewSinceJC is offline Offline
Posting Virtuoso

Re: Palindromes

 
0
  #13
Dec 20th, 2008
And you don't have to use recursion to test whether something is a palindrome or not.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC