Originally posted by Mark Herschberg:
Some types of casting isn't avoidable, such as castig to meed method signatures. A common example is storing items in vectors. Everytime you get an item from a vector, it comes back as an Object. You may then need to downcast it. If you find yourself doing this often, ask youself if a vector is really the only option. Maybe an array or other data structure is a better option.
Originally posted by Rob Acraman:
Is there any difference in cost between checking for checked vs. unchecked exceptions?
Originally posted by Marius Holm:
1) How do you track Object creation/deletion, garbage collection and other memory/resource allocating processes?
From some of the messages around it seems that programmers that seem to be more into this than I am, have difficulties with controlling (keeping track of) Object instances throughout program execution. Now, in my simple world, the general solution to this is to do nothing, as the gc eats it all when all refs/the last ref to that Object has a null value. (Similarly, when that Object is handled by the gc, all the refs that the Object itself contains, are set to null, or deleted, and the intances these point to are handled (that means deleted, right?) by the gc as well). I can understand that in some cases, when you want to reuse that variable/pointer dynamically in your code and it sometimes is assigned to a new Object, and sometimes not, that things may become somewhat more complicated but still... Well, anyway, are there some system functions that you can use during debugging for instance, that will report your Object/resource allocation during program flow?
2) What is a checked vs. an unchecked Exception?
I see one guy asks about differences between checked vs. unchecked Exceptions, and he even gets an answer on this. I didn't know there existed such a term. Anyone care to tell me what it is?
Marius Holm wrote:
How do you track Object creation/deletion, garbage collection and other memory/resource allocating processes?