• Post Reply Bookmark Topic Watch Topic
  • New Topic

Difference in two code-generic collection  RSS feed

 
Merin George
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

/*

Can anyone explain why with first one getting compilation error and exception with second one?

This is from ocjp practice exam 2;
 
Stefan Evans
Bartender
Posts: 1837
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where does the first one end and the second one start?
Code tags would maybe have been useful here.


Have you got any guesses yourself?
Have you tried to compile/run the code?

 
Campbell Ritchie
Marshal
Posts: 56584
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch
I tried adding code tags←link and I think I made it look better but I lost the /* in the process. Don't use /*...*/ for commenting out. Always use // Also please indent your code correctly; you can confuse yourself greatly otherwise.
When you compiled the code, what warnings or error messages did you receive? Those will give you a hint about what is going wrong. You may have to add the Xlint tag as suggested to get the full details. In fact using Xlint may give you the full explanation. Any messages from the Exception will be helpful too.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!