Java中Error和Exception

作者: CodingDGSun | 来源:发表于2021-07-08 13:29 被阅读0次

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关系图如下所示

24_01

相关文章

网友评论

    本文标题:Java中Error和Exception

    本文链接:https://www.haomeiwen.com/subject/qpxtpltx.html