3/09/2008

UnsupportedOperationException and OperationNotSupportedException

For some unimplemented methods, I want to throw some exception instead of leaving it blank. I know there is already such a class in Java but don't know its exact name. So I typed "Operation" and then Ctrl-Space to let NetBeans to complete it. But only javax.naming.OperationNotSupportedException showed up, which is not what I want. After some search, it turns out the right class is java.lang.UnsupportedOperationException. Description from its javadoc:
java.lang.Object
extended by java.lang.Throwable
extended by java.lang.Exception
extended by java.lang.RuntimeException
extended by java.lang.UnsupportedOperationException
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
HeadlessException, ReadOnlyBufferException

public class UnsupportedOperationException
extends RuntimeException

Thrown to indicate that the requested operation is not supported.

This class is a member of the Java Collections Framework.

Since:
1.2

3 comments:

Anna said...

Great and Useful Article.

Online Java Course

Java Online Training

Java Course Online

J2EE training

online J2EE training

Best Recommended books for Spring framework

Java Interview Questions












Java Training Institutes in Chennai

Java Training in Chennai

J2EE Training in Chennai

java j2ee training institutes in chennai

jazz said...

Finding the time and actual effort to create a superb article like this is great thing. I’ll learn many new stuff right here! Good luck for the next post buddy..
Sharepoint Training in Chennai

Vũ Diệu Linh said...

I enjoyed on reading your blog post. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. Please visit my website, Friv 4000 Games is where all the free friv games.
Friv 4000