jQuery in Action, 2nd edition*
The moose likes Beginning Java and the fly likes two puzzling errors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "two puzzling errors" Watch "two puzzling errors" New topic
Author

two puzzling errors

Jesse Crockett
Ranch Hand

Joined: Feb 03, 2005
Posts: 129
This is a lab problem for class. I don't understand the two errors at compilation. The error messages:





I also don't understand why the lab requires moreData() to have a String formal parameter.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

The moreData method does not seem to use any parameters, so I would remove the argument. If you do leave it in, then the type needs to be specified -- which is what the compiler is complaining about. (Note that the method is called with a String.)

The isLeap method also requires a type for its argument. (And the first println in that method is missing a closing parenthesis.)

Now, here's a big mistake that everyone makes at least once: A single equals sign is used for assignment (=). Two equals signs are required for comparison (==).
[ February 04, 2006: Message edited by: marc weber ]

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Jesse Crockett
Ranch Hand

Joined: Feb 03, 2005
Posts: 129
now I get the logical errors. I thought you were joking.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Jesse Crockett:
now I get the logical errors. I thought you were joking.

Ah, yes... The wink was meant as, "Just something to keep in mind, because we've all done that before."
[ February 04, 2006: Message edited by: marc weber ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: two puzzling errors