Whenever I define a new exception, I tend to do one of two things:
- Create an exception file containing a list of all the new exceptions defined in my project.
- Put each specific exception in the same file as the class in which it was thrown.
Netbeans do not like it when I have a public exception defined in the same file as another class, for example, in paragraph 2. Although I have not tried this yet, I believe that it will yell at me for similar reasons for having more than one exceptions in the same file as in paragraph 1.
Should each exception really have its own file, or is there some other style that Netbeans will accept? I am new to Java and Netbeans and would like to hear what the appropriate style is.
source
share