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

Answer Posted / chinna

Yes,

public class UnCheckedExceptionExam extends RuntimeException
{

public UnCheckedExceptionExam(){
System.out.println("No argument");
}
public UnCheckedExceptionExam(String message){
System.out.println(message);
System.out.println(initCause(new Throwable("define
exception")));
}
public UnCheckedExceptionExam(Throwable cause){
System.out.println(cause.getCause());
}
public UnCheckedExceptionExam(String message,Throwable
cause){
System.out.println(message);
System.out.println(cause.getCause());

}
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

HOW MUCH PERCENTAGE WE DEDUCT FOR OUR SUPPLIERS OR OTHER PROFESSIONALS

1753


What is iterator in the java collections framework? : java collections

737


What is deque in the java collections framework? : java collections

726


What is the use of hashcode in java ?

794


What are maps interfaces in the java collections? : java collections

774


Which sorting algorithm is used by collections.sort() in java ?

733


What is the use of the list interface in the java collection? : java collections

788


What are the interfaces in java collections? : java collections

838


What are the uses of the set interfaces in the java collections? : java collections

747


What are the considerations to be made in case of loops in java ?

780


What are the types of interface used in the java collections? : java collections

784


What are the main classes of the list interfaces? : java collections

777


What are the different types of classes implemented in the set interfaces? : java collections

825


What are the types of the main implementing classes in the map interfaces? : java collections

838


What are the queues in the java collection framework? : java collections

741