Glorified classes in the Java language

前端 未结 13 1815
一生所求
一生所求 2021-01-29 20:32

Some classes in the standard Java API are treated slightly different from other classes. I\'m talking about those classes that couldn\'t be implemented without special support f

13条回答
  •  走了就别回头了
    2021-01-29 21:00

    Well since the special handling of assert has been mentioned. Here are some more Exception types which have special treatment by the jvm:

    • NullPointerException
    • ArithmeticException.
    • StackOverflowException
    • All kinds of OutOfMemoryErrors
    • ...

    The exceptions are not special, but the jvm uses them in special cases, so you can't implement them yourself without writing your own jvm. I'm sure that there are more special exceptions around.

提交回复
热议问题