Computer Science Canada BufferedReader error? |
Author: | Aziz [ Sat Jun 25, 2005 7:56 pm ] | ||||
Post subject: | BufferedReader error? | ||||
Why does this code:
give my this compile-time message:
|
Author: | wtd [ Sat Jun 25, 2005 10:05 pm ] | ||
Post subject: | |||
Let me clear up something first. In Java you need not declare an object and initialize it separately.
That works just fine and saves you a line of code. |
Author: | 1of42 [ Sun Jun 26, 2005 12:41 am ] |
Post subject: | |
I'm not 100% sure why it says that - maybe drawing to your attention unchecked exceptions that you are not explicitly dealing with (despite the throws clause)? It compiles without warnings for me though, so I'd say you're fine to work with the code. |
Author: | Aziz [ Mon Jun 27, 2005 1:10 am ] |
Post subject: | |
Thanks a bunch. And yeah, in the HighScoreList class I've been working on today (converted from Turing, java makes it much better ![]() ![]() |
Author: | Hikaru79 [ Sun Jul 17, 2005 10:04 pm ] | ||
Post subject: | |||
Try doing what the error says. It says to try recompiling with the -Xlint:unchecked flag, so do so, and this is what you get:
Basically, you're not checking for a certain exception in the vector's add(E) method. This one throws a bunch of unchecked exceptions so I'm not sure which one its complaining about, but ClassCastException is the most likely candidate. Try catching that and see what happens ![]() |