I am nearing the end of the Spring college semester. This semester I am taking a Java programming class. There was one chapter near the end of the course on exceptions. We did not spend much time on it because there is not much time left. However I am still trying hard to wrap my hands around the concept.
Exceptions are not unique to the Java programming language. I know C++ has them. And I would guess many other languages have them as well. It is straight forward how to throw and catch an Exception object. You are just passing a message. However I have still not yet found a great reason to create my own exception classes. I guess I could use them to ensure the caller can separate exceptions with different catch blocks. But aren't they all going to just call getMessage() on my object?
Here is one thing I have determined about exceptions. This also applies to any classes you write. You should not name the class with too long of a name. It gets tiring to type all those characters. Yes I know you can cut and paste. But if there is a misspelling, and there are a million characters in the name, it takes a long time to figure out where I went wrong. I am going to do a bunch of programming projects where I throw and catch exceptions. Perhaps after that I will have a better feel for them.
Reproducing a Race Condition
-
We have a job at work that runs every Wednesday night. All of a sudden, it
aborted the last 2 weeks. This caused some critical data to be late. The
main ...
2 years ago