I was just working on my program based on collections, However when i run the program successively without making any changes in the code,....even then i get different results in my the console.
I am using jdk 1.6 and Eclipse 3.1
Following is the code:-
When a runtime exception is thrown then how come i am able to see the SOP statements after the exception has been thrown as can be seen in output#2 ? ..... Can any one please tell if this the problem of the eclipse or my program ? Actually through this program i want to create a situation, so that the program throws an "UnsupportedOperationException". Can any one please guide me through as to how i can get the desired exception? ... Please ?
Million thanks in advance ranchers!
Thanks for the prompt and short and sweet reply. I'll take care of that from next time. Here i thought that i would be more specific with my question, so i posted my code also. And its only because of the code that the length of the question appears to be too long. Also, Here i have mentioned what my problem was, and that is i am not able to understand why i get different outputs inspite of the fact that i run the same program without making any changes in it. Also, i think i was quiet clear to mention another problem that i am facing and that is how i can create a situation so that i get an "UnsupportedOperationException". Well, my first problem is solved. I have realized that it was due to Eclipse. But my second problem is still not solved. .... Can you please help me solve my second problem ? .... Or still 99% of the text is irrelevant ? Please let me know. May be i will go through the forum conventions and rules and regulation 99 times, so that i am not 99% irrelevant !
Once again Thanks Ernest!
Well, my first problem is solved. I have realized that it was due to Eclipse. But my second problem is still not solved. .... Can you please help me solve my second problem ? .... Or still 99% of the text is irrelevant ? Please let me know. May be i will go through the forum conventions and rules and regulation 99 times, so that i am not 99% irrelevant !
The relevancy has nothing to do with the rules. Think about it. If someone has a question for you, which are you more likely to answer? A short-to-the-point question? Or a question, attached to a long program, which 99 percent works?
Ernest is pointing out that if you make your question more readable, maybe there is a chance that more people would actually read it!!!
This is saying that the addAll() method is encountering a null pointer exception. You don't have more info than this, but you can get more if you attach the Java source code to your IDE.
But if I had to guess, you probably passed in a null pointer that it wasn't expecting.... like so...