关于java:Java中Error和Exception

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

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理