[java] What is the standard exception to throw in Java for not supported/implemented operations?

In particular, is there a standard Exception subclass used in these circumstances?

This question is related to java

The answer is


Differentiate between the two cases you named:


If you create a new (not yet implemented) function in NetBeans, then it generates a method body with the following statement:

throw new java.lang.UnsupportedOperationException("Not supported yet.");

Therefore, I recommend to use the UnsupportedOperationException.


If you want more granularity and better decription, you could use NotImplementedException from commons-lang

Warning: Available before versions 2.6 and after versions 3.2, only.