Talk:Comparison of C Sharp and Java: Difference between revisions

Content deleted Content added
Edit: my error. That may not happen with unchecked excs
Line 676:
"Another criticism of checked exceptions is that a new implementation of a method may cause unanticipated checked exceptions to be thrown., which is a contract-breaking change. This can happen in methods implementing an interface that only declares limited exceptions, or when the underlying implementation of a method changes. To allow for such unanticipated exceptions to be thrown, some programmers simply declare the method can throw any type of exception ("<code>throws Exception</code>"), which defeats the purpose of checked exceptions."
 
This may not happen with ''un''checked exceptions, '''not''' with checked exceptions. A checked exception must be declared in the public API of the method (''throws'' clause) if you want to throw it. Therefore you may not throw a new type of checked exception unless you intentionally break the API, and this will not happen neither if you are just implementing an interface, nor change the method implementation (as it is not part of the API). --[[Special:Contributions/151.75.20.202|151.75.20.202]] ([[User talk:151.75.20.202|talk]]) 13:20, 26 May 2011 (UTC)
 
:You could have added '''un''' instead of removing the whole section. So your reason for removing it must be something else. I'm not sure whether this discussion should be present. Is discussing the ''consequences'' of diffferences between the languages too far beyond the scope of this article? [[User:Rp|Rp]] ([[User talk:Rp|talk]]) 21:27, 27 May 2011 (UTC)