异常类-选中还是未选中? [英] exception class - checked or unchecked?
本文介绍了异常类-选中还是未选中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在创建自己的异常类时,如何确定是否应对其进行检查?
When creating your own exception class, how do you decide whether it should be checked or unchecked?
推荐答案
我假设您是Java开发人员C#,否则我不会理解您的问题(如果可以的话,您可以澄清一下,否则您可能需要将标签从"C#"更改为"Java"!).
学习C#并没有等同于checked和unchecked异常,您会感到难过(或高兴!). c#中的所有异常都类似于Java未经检查的异常.
此处 [ ^ ]是Java和C#之间的比较.如果有些过时的话(IMO C#在v2.0上使用Java达到了水平,而在3.0上超过了Java),但是如果有些Java偏见,大多数比较是好的::).
I''m assuming you are a Java dev trying out C#, otherwise I don''t understand your questions (if so can you clarify, or you might need to change the tag from "C#" to "Java"!).
You''ll be saddened (or delighted!) to learn C# doesn''t have the equivalent of checked an unchecked exceptions. All exceptions in c# are like Java unchecked exceptions.
Here[^] is a comparison between Java and C#. Some if it is a little out of date (IMO C# drew level with Java at v2.0, and overtook at 3.0) but the most of the comparisons are good, if a little Java Biased :-).
这篇关于异常类-选中还是未选中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文