How and where do you define your own Exception hierarchy in Java?

前端 未结 5 868
广开言路
广开言路 2020-12-28 14:12

How and where do you define your own Exception hierarchy in Java?

My main question concerns package location where your Exception classes must be defined.

Do

5条回答
  •  盖世英雄少女心
    2020-12-28 14:26

    The language does not specify any requirements for what packages user-defined Exception classes should be put in. As long as the class extends java.lang.Throwable, it can be thrown.

提交回复
热议问题