| Author |
Missing a ')' somewhere...
|
Lisa Beglaw
Ranch Hand
Joined: Jul 16, 2005
Posts: 65
|
|
I keep getting an error ')' missing and highlighting the first System.out line. But that line seems fine as do the ones above it. Is a missing bracket the ACTUAL problem?
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24081
|
|
if (currentMovie.getCurrentlyRented() = true) { Should be if (currentMovie.getCurrentlyRented() == true) { but if you instead used the preferred if (currentMovie.getCurrentlyRented()) { this wouldn't have happened!
|
[Jess in Action][AskingGoodQuestions]
|
 |
Lisa Beglaw
Ranch Hand
Joined: Jul 16, 2005
Posts: 65
|
|
|
Thank you thank you thank you....I thought I was OVER the == errors by now! I thought I had learned my lesson with my last assignment!
|
 |
Lisa Beglaw
Ranch Hand
Joined: Jul 16, 2005
Posts: 65
|
|
New question on the same method...when I run the method, I get the comment lines printed twice. Total number of movies = 2 Of those movies 0 are currently rented out. Total number of movies = 2 Of those movies 0 are currently rented out. is what prints out...and I did clear my comments screen just to make sure. I am assuming it is printing out one line for each movie. How can I get it to only print out once?
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24081
|
|
These two lines System.out.println("Total number of movies = " + movieCollection.size()); System.out.println("Of those movies " + rentedResults + " are currently rented out."); are inside the loop, so they're executed once for every movie. You need to move them after the loop, so they're only executed after all the statistics are collected.
|
 |
Lisa Beglaw
Ranch Hand
Joined: Jul 16, 2005
Posts: 65
|
|
Again...so simple. Why can I not see these simple little errors? Thank you again!
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24081
|
|
|
For many of them, a good programmer's editor really helps a lot. You can make things a lot easier on yourself by using even something simple like JPad .
|
 |
Stephen Boston
Ranch Hand
Joined: Jul 14, 2005
Posts: 165
|
|
I find JCreator very helpful on finding errors. (And I make a lot of them! )
|
Steve<br /> <br />No matter where you go, there you are.<br /> <br />"My evil self is at the door, and I have no power to stop it."
|
 |
 |
|
|
subject: Missing a ')' somewhere...
|
|
|