[Solved] Java Class Exception [closed]


Best practice is to make them separate classes in three different source code files.

It is possible to have more than one class in a single source code file by using inner classes. However, I would advise against it in this case, because it would break best practice. And the compiler will still create separate .class files for the inner classes.

Yes, you get a lot of files. That is the way java is designed.
You don’t have to like it, but you have to accept it (or switch to another language).

When it comes to using them from another package you can easily do that. Just declare the classes public.

public class FirstException extends Exception
public class IllegalValue extends FirstException
public class IllegalIntValue extends FirstException

solved Java Class Exception [closed]