Is it possible to create Userdefined Unchecked Exception
also?If Yes, give an example?

Answer Posted / saf

You can create unchecked exception by inhereting
RuntimeException class. Spec does not say that we can't do
it but it is advisable to go for custom checked exception

Is This Answer Correct ?    17 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What will happen if there is a default method conflict as mentioned above and we have specified the same signature method in the base class instead of overriding in the existing class ?

512


What will happen if a thrown exception is not handled?

557


What are the important features of Java 11 release?

572


Explain with example the concept of constant variable in java.

619


Are arrays primitive data types?

631






How to overcome the exception object reference not set to an instance of object?

616


What is a superclass?

920


What are "class access modifiers" in Java?

604


What is the size of an array?

547


What are the approaches that you will follow for making a program very efficient?

638


What happens if an exception is not handled in a program?

620


What is the arraylist in java?

524


Suppose if we have variable ' I ' in run method, if I can create one or more thread each thread will occupy a separate copy or same variable will be shared?

535


How can we create an immutable class in java?

579


Can a main method be declared final?

579