answersLogoWhite

0

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...

User Avatar

Wiki User

16y ago

What else can I help you with?

Continue Learning about Engineering

Is error and exception same?

Error: Any departure from the expected behavior of the system or program, which stops the working of the system is an error. Exception:Any error or problem which one can handle and continue to work normally. Note that in Java a compile time error is normally called an "error," while a runtime error is called an "exception." Errors don't have subclasses while exception has two subclasses, they are compile time exception or checked exception (ClassNotFound Exception, IOException, SQLException etc.) and runtime or unchecked exception(ArrayIndexOutOfBounds Exception, NumberFormat Exception).


Throws exception function in java?

throws exception is a common signature pattern for methods. It is used to signify the fact that the code inside the method may throw exceptions of the types mentioned in the method signature. The calling method must have code to handle the exception effectively. Ex: public String getName() throws SQLException { ..... } This method's code can throw an SQLEXception and the calling method must have the code to handle this exception


What is defferred exceptional handling?

Deferred exception handling refers to a programming design pattern where individual class level methods do not handle exceptions using try catch blocks. They just cascade the exceptions to the calling methods using the "throw" keyword and all exceptions are handled centrally in one place. This is called deferred exception handling where the exceptions are deferred in the place where they occur and propagated to a parent class which handles it.


Describe different ways that a function can handle errors?

There are two ways. The method can have a try catch block and handle the error/exception inside the method. Or The method can throw the exception under the assumption that the calling method would have the code to handle the exception that is thrown by this method


How many constructors does class Exception have?

The Exception class has 4 constructors. They are: a. Exception() b. Exception(String arg) c. Exception(String arg, Throwable arg1) d. Exception(Throwable arg)

Related Questions

How do you include userdefined headerfiles in c plus plus program?

#include "what-its-name-is.h"


What is the Event resulting from an unusual situation that disrupts normal program flow?

It is called an exception. There are two ways of handling exceptions inside java methods. The method can have a try catch block and handle the error/exception inside the method. Or The method can throw the exception under the assumption that the calling method would have the code to handle the exception that is thrown by this method


What is an IllegalArgument Exception?

An IllegalArgument exception is usually generated when the arguments passed to a method do not match the data type of the arguments the method expects. Most of these problems are caught by the compiler but in cases where Java Reflection is used to generate and call methods dynamically, we can often encounter this exception.


In negro digs up his past what is Arthur schomburg discussing?

the history of african americans APEX :)


Compare the two methods of serial transmission on the basis of effectiveness and speed?

*Which* two methods?


Methods of collecting information?

what are the two methods of collecting information


What are the two approved methods of sanitization in restaurants?

Two methods of sanitizing are cleaning with alcohol and cleaning with bleach.


What are the depreciations methods?

two methods: Cost method and diminishing balance method


-------- and ---------- are two methods by which you can effectively block communication with others?

Displacing and evaluating are two methods by which you can effectively block communication with others.


What are two methods scientist use to obtain emperical evidence?

The scientific method and peer review are two methods that a scientist uses to obtain empirical evidence. Experimental design and reproduction of results are two other methods.


Is error and exception same?

Error: Any departure from the expected behavior of the system or program, which stops the working of the system is an error. Exception:Any error or problem which one can handle and continue to work normally. Note that in Java a compile time error is normally called an "error," while a runtime error is called an "exception." Errors don't have subclasses while exception has two subclasses, they are compile time exception or checked exception (ClassNotFound Exception, IOException, SQLException etc.) and runtime or unchecked exception(ArrayIndexOutOfBounds Exception, NumberFormat Exception).


Is oxygen an exception to the octet rule?

Yes, oxygen is an exception to the octet rule. Molecular oxygen can have two unpaired electrons making it a biradical molecule.