What is user defined exception in Java?



What is user defined exception in Java?..

Answer / Pritibhi Kumar

User-defined exceptions are custom exceptions created by developers to handle specific error conditions that may occur within a program. They extend the built-in Exception class or one of its subclasses and can be thrown when an unexpected event occurs during the execution of a method.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

enlist some features of jdk.

1 Answers  


If I will write String s=new String("XYZ"); String s1=new String("XYZ"); if(s.equals(s1)){ sop("True"); } else{ sop("False"); } This program will give me "True". But When I am creating my own class suppose class Employee{ public Employee(String name); } Employee e= new Employee("XYZ"); Employee e1 = neew Employee("XYZ"); if(e.equals(e1)){ sop("True"); } else{ sop("False"); } Then it will give the output as "False". Can I know what is happening internally?

5 Answers  


using equals method overriding which objects are compared?i.e same class objects or other class objects?Explain me.

4 Answers  


what is mutual exclusion? : Java thread

1 Answers  


What is a class variable?

1 Answers  


what do you understand by synchronization? : Java thread

1 Answers  


What is the default initialized value of String type variable?

4 Answers  


What is difference between arraylist and list in java?

1 Answers  


What do you understand by synchronization?

1 Answers  


i need to know the website that i can compile and run a java code in online.(while system doesn't contain any jdk and jre)

0 Answers  


Which java version is latest?

1 Answers  


What is a Java package and how is it used?

2 Answers  


Categories