answersLogoWhite

0


Best Answer

We can create a exception sub class by extending Exception class available in java

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How an exception subclass is created in java explain?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How exception subclass is created in java?

To handle the exceptions in large programs


In Java is a class a subclass of itself?

No.


A program to explain the Exception Handling mechanisms in Java using the keywords try catch and finally?

Here is a code snippet illustrating exception handling: try { int a= 3 / 0 ; } catch ( ArithmeticException e ) { System.out.println ("An ArithmeticException has occured"); } finally { // some code }


How might one use the java subclass SimpleDateFormat?

One might use the Java subclass "SimpleDateFormat" when programming a Java application that needs to display the date. This would be then be used to show the user the current date in real time.


Is every class in java is subclass of itself?

A class can be a subclass of another class, not of itself.A class can be a subclass of another class, not of itself.A class can be a subclass of another class, not of itself.A class can be a subclass of another class, not of itself.


Explain how objects are created in Java?

with new operator


Can userdefined exception have two methods in it?

Yes a user defined exception can have any number of methods in it. A user defined exception is nothing but a Java class created for a specific purpose. Just like ordinary Java classes, you can have any number of methods in it...


What is the purpose of NoMatchException handling method in java?

java exception


What is subclasses in java?

Subclasses are classes that inherit from parent classes. i.e. ArrayList is a subclass of List.


What is unchecked exception?

A checked exception is an exception which the Java source code must deal with, either by catching it or declaring it to be thrown. Unchecked exceptions are all exceptions which do not follow this rule. When an unchecked exception is thrown, it is usually caused by a misuse of code - passing a null or otherwise incorrect argument. This includes classes like NullPointerException and IllegalArgumentException. Checked exceptions are generally caused by faults outside of the code itself - missing resources, networking errors, and problems with threads come to mind. These could include subclasses of FileNotFoundException, UnknownHostException, etc. The Java documentation (link below) gives some loose guidelines to follow when trying to decide which type of exception to use: "If a client can reasonably be expected to recover from an exception, make it a checked exception. If a client cannot do anything to recover from the exception, make it an unchecked exception." From a purely code-oriented point of view, a checked exception is a subclass of Exception, while an unchecked exception is a subclass of RuntimeException.


Can a single Java class subclass extend both InputStream and Reader. True or False?

Java does not have multiple inheritance, so no. Java can use multiple interfaces, though, with the "implements" keyword.


Which exception is thrown by the add method of Collection interface in java?

exception