English 中文(简体)
Java的无节制例外:从错误或长期欺骗中继承?
原标题:Unchecked exceptions in Java: Inherit from Error or RuntimeException?

I would like to handle errors with (unchecked) exceptions. I heared that for each kind of exception I should create a subclass of either Error or RuntimeException. What s the difference?

最佳回答

rel=“noreferer”> Errors应查明在方案上无法解决的问题(例如从记忆中删除)。 rel=“noreferer”>Exceptions应当查明方案上可回收的问题,这些问题是由法规外出的意外情况造成的(例如,编码)。 rel= develop_noreferer>。

您希望继承<代码>。

问题回答

我认为 Java文如此说:

An Error is a subclass of Throwable * that indicates serious problems that a reasonable application * should not try to catch. Most such errors are abnormal conditions. * The ThreadDeath error, though a "normal" condition, * is also a subclass of Error because most applications * should not try to catch it.

这些东西如 st,从记忆中消失......你希望延长停留时间。

开放式收割是一种特殊的例外情况,但汇编者不会赶走。 如果存在某种严重的制度问题,就会出现错误。 Error和RuntimeException之间没有密切的关系。 你们似乎更接近于追捕。

航道几乎从未见过Error案。

我听到的是,尽管我没有真正理解,但你自己却制造了例外。 这常常是有用的,但我却使用了“Invalid ArgumentException All the Tight”。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签