Java 相当于 .Net 的 NotSupportedException

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1062937/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 15:00:14  来源:igfitidea点击:

Java equivalent to .Net's NotSupportedException

java.netexception

提问by ripper234

Is there (not NotImplementedException, not supported).

是否存在(不是 NotImplementedException,不支持)。

回答by Thilo

java.lang.UnsupportedOperationException

java.lang.UnsupportedOperationException

Or, if you use Apache Commons Lang and the operation should be supported, but has not been implemented (yet?):

或者,如果您使用 Apache Commons Lang 并且应该支持该操作,但尚未实现(尚未实现?):

org.apache.commons.lang.NotImplementedException

org.apache.commons.lang.NotImplementedException

回答by user121803

You can use either UnsupportedOperationException or NoSuchMethodException or extend the Exception class and create your own custom exception called NotImplementedException or whatever

您可以使用 UnsupportedOperationException 或 NoSuchMethodException 或扩展 Exception 类并创建您自己的名为 NotImplementedException 的自定义异常或其他任何异常