Whenever I define a new exception, I tend to do one of two things:
- Create an exceptions file which contains a listing of all the new exceptions defined in my project.
- Put each defined exception in the same file as the class in which it is thrown.
Netbeans doesn't doesn't like it when I have a public exception defined in the same file as another class such as in point 2. While I haven't tried it yet, I believe it would yell at me for similar reasons for having more than one exception in the same file as in point 1.
Should each exception really have its own file, or is there some other style which Netbeans will accept? I'm fairly new to Java and Netbeans and would love to hear what the appropriate style is.