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關係圖如下所示