JAVA受检异常和⾮受检异常举例
受检异常和⾮受检异常(运⾏时异常)举例
RuntimeException(即⾮受检异常):
  RuntimeException在默认情况下会得到⾃动处理,所以通常⽤不着捕获RuntimeException。RuntimeException是那些可能在Java虚拟机正常运⾏期间抛出的异常的超类,可能在执⾏⽅法期间抛出但未被捕获的RuntimeException的任何⼦类都⽆需在throws⼦句中进⾏声明。
  java.lang.ArithmeticException
  java.lang.ArrayStoreExcetpion
  java.lang.ClassCastException
  java.lang.EnumConstantNotPresentException
  java.lang.IllegalArgumentException
  java.lang.IllegalThreadStateException
  java.lang.NumberFormatException
  java.lang.IllegalMonitorStateException
  java.lang.IllegalStateException
  java.lang.IndexOutOfBoundsException
  java.lang.ArrayIndexOutOfBoundsException
  java.lang.StringIndexOutOfBoundsException
  java.lang.NegativeArraySizeException
  java.lang.NullPointerException
  java.lang.SecurityException
  java.lang.TypeNotPresentException
  java.lang.UnsupprotedOperationException
受检异常:
  除了RuntimeException以外的异常,都属于CheckedException,它们都在java.lang库内部定义。Java编译器要求程序必须捕获或声明抛出这种异常。⼀个⽅法必须通过throws语句在⽅法的声明部分说明它可能抛出但并未捕获的所有CheckedException。
  java.lang.ClassNotFoundException
  java.io.FileNotFoundException
  java.io.IOException
  java.sql.SQLException
  java.SocketException
  java.lang.CloneNotSupportedException
  java.lang.IllegalAccessException
  java.lang.InterruptedException
  java.lang.NoSuchFieldException
  java.lang.NoSuchMetodException
(附)Java API中Exception的直接已知⼦类:
AclNotFoundException
ActivationException
nullpointerexception为什么异常AlreadyBoundException ApplicationException AWTException BackingStoreException BadAttributeValueExpException BadBinaryOpValueExpException BadLocationException BadStringOperationException BrokenBarrierException CertificateException ClassNotFoundException CloneNotSupportedException DataFormatException DatatypeConfigurationException DestroyFailedException ExecutionException ExpandVetoException FontFormatException GeneralSecurityException GSSException IllegalAccessException IllegalClassFormatException InstantiationException InterruptedException IntrospectionException InvalidApplicationException InvalidMidiDataException InvalidPreferencesFormatException InvalidTargetObjectTypeException InvocationTargetException IOException
JAXBException
JMException KeySelectorException LastOwnerException LineUnavailableException MarshalException MidiUnavailableException MimeTypeParseException MimeTypeParseException NamingException NoninvertibleTransformException NoSuchFieldException NoSuchMethodException NotBoundException NotOwnerException ParseException ParserConfigurationException PrinterException PrintException PrivilegedActionException PropertyVetoException RefreshFailedException RemarshalException RuntimeException SAXException ScriptException ServerNotActiveException SOAPException SQLException TimeoutException TooManyListenersException TransformerException TransformException UnmodifiableClassException UnsupportedAudioFileException UnsupportedCallbackException UnsupportedFlavorException
UnsupportedLookAndFeelException URIReferenceException URISyntaxException UserException
XAException XMLParseException XMLSignatureException XMLStreamException XPathException

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。