关于java:Java中Error和Exception

36次阅读

共计 1473 个字符,预计需要花费 4 分钟才能阅读完成。

Error 和 Exception 区别:

  • Error:程序无奈解决的谬误
  • Exception:程序自身能够解决的异样

PantUML 语法

A <|-- B // B 继承 A
C <|... D // D 实现了 C 
@startuml

interface Serializable{ }

class Throwable{ }

class Exception{ }

class Error{ }

class IOError{ }

abstract class VirtualMachineError{ }

class AWTError{ }

class StackOverflowError{ }

class OutOfMemoryError{ }

class IOException{ }

class RuntimeException{ }

class ReflectiveOperationException{ }

class ClassNotFoundException{ }

class EOFException{ }

class FileNotFoundException{ }

class ArithmeticException{ }

class MissingResourceException{ }

class NullPointerException{ }

class IllegalArgumentException{ }

class IndexOutOfBoundsException{ }

class ArrayIndexOutOfBoundsException{ }

class UnknownEntityException{ }

class UnknownTypeException{ }

Serializable <|.. Throwable

Throwable <|-- Exception
Throwable <|-- Error

Error <|-- IOError
Error <|-- VirtualMachineError
Error <|-- AWTError

VirtualMachineError <|-- StackOverflowError
VirtualMachineError <|-- OutOfMemoryError

Exception <|-- IOException
Exception <|-- RuntimeException
Exception <|-- ReflectiveOperationException

ReflectiveOperationException <|-- ClassNotFoundException

IOException <|-- EOFException
IOException <|-- FileNotFoundException

RuntimeException <|-- ArithmeticException
RuntimeException <|-- MissingResourceException
RuntimeException <|-- NullPointerException
RuntimeException <|-- IllegalArgumentException
RuntimeException <|-- IndexOutOfBoundsException
RuntimeException <|-- UnknownEntityException

UnknownEntityException <|-- UnknownTypeException

IndexOutOfBoundsException <|-- ArrayIndexOutOfBoundsException

@enduml

Java 中异样类关系图,UML 关系图如下所示

正文完
 0