answersLogoWhite

0


Best Answer

Systems don't throw exceptions. System errors are low-level errors which you have to detect programmatically. In C, most functions that cause system errors will typically return -1 to indicate an error has occurred and 0 to indicate no error. If an error occurs, you should examine the global errno variable to determine the actual error code (as defined in <errno.h>). You can use the strerror() function to obtain a pointer to the string representation of the error, and perror() to display the error.

If you cannot handle the error there and then, then you should pass the error to your error handling code. Languages that support exception handling make it easy to pass errors from the point they are detected to a point where they can be handled. Simply transform the error code into an exception object and then throw the object, allowing the exception handling mechanism to deal with it.

User Avatar

Wiki User

7y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

13y ago

user defined exceptions are only to handle the general use case like divide by zero, where as the system defined exception are generating from system error during compile time but do not affect its execution.

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

difference between system defined and user defined functions in .net technology

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are the main differences between user-defined exceptions and system-defined exception?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

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 implication of catching all the exceptions with the type Exception?

though catching exceptions is a good practice inside java code, catching all exceptions of the type exception is not the best way to go. Specific exceptions need to be caught instead of the generic Exception being caught. Also, different types of exceptions need to be handled separately.


Describe the JAVA throwable class hierarchy and types of exceptions?

In Java there are two main types of Exceptions. * Checked Exceptions - The ones that can be checked &amp; handled in our code. Ex: I/O Exception, SQL Exception etc. In most cases, the compiler itself forces us to catch &amp; handle these exceptions * Un-checked Exceptions - The ones that we cannot &amp; should not handle in our code. Ex. Null Pointer Exception The java.lang.Throwable is the super class of all errors and exceptions in Java. Only objects of this class can be thrown &amp; caught and handled by try-catch blocks. Ex: try { ..... ..... } catch (Exception e){ ... } finally { ... }


Is exception handling implicit or explicit?

In Java, Exception Handling is Explicit. The Programmer has to write code that will ensure that the exceptions are caught and appropriately handled


What is the purpose of claiming exceptions?

it informs compiler about its possible exceptions. For example,The purpose of Java exception is to tell the Java runtime system what can go wrong

Related questions

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 are the types of exception in java?

Exceptions are of two types: checked exceptions and unchecked exceptions.


What is the implication of catching all the exceptions with the type Exception?

though catching exceptions is a good practice inside java code, catching all exceptions of the type exception is not the best way to go. Specific exceptions need to be caught instead of the generic Exception being caught. Also, different types of exceptions need to be handled separately.


Difference between checked and unchecked exception?

Checked exceptions are exceptions which need to be handled explicitly. These are the ones which require a try-catchblock or a throws keyword.Unchecked exceptions are exceptions which have no obligation to be handled. A NullPointerException is one common example.


How do you use a sentence with exception in it?

There were always exceptions to the rule.


What is user exceptions?

user defined exception is created by user such as arthmetic,number format exception ...


What is 'exceptions' when translated from English to Italian?

"Exceptions" in English is eccezioni in Italian.


What are the exceptions of Android?

The following are the exceptions that are supported by AndroidInflateException : When an error conditions are occurred, this exception is thrownSurface.OutOfResourceException: When a surface is not created or resized, this exception is thrownSurfaceHolder.BadSurfaceTypeException: This exception is thrown from the lockCanvas() method, when invoked on a Surface whose is SURFACE_TYPE_PUSH_BUFFERSWindowManager.BadTokenException: This exception is thrown at the time of trying to add view an invalid WindowManager.LayoutParamstoken.


Describe the JAVA throwable class hierarchy and types of exceptions?

In Java there are two main types of Exceptions. * Checked Exceptions - The ones that can be checked &amp; handled in our code. Ex: I/O Exception, SQL Exception etc. In most cases, the compiler itself forces us to catch &amp; handle these exceptions * Un-checked Exceptions - The ones that we cannot &amp; should not handle in our code. Ex. Null Pointer Exception The java.lang.Throwable is the super class of all errors and exceptions in Java. Only objects of this class can be thrown &amp; caught and handled by try-catch blocks. Ex: try { ..... ..... } catch (Exception e){ ... } finally { ... }


Can a scientific law have an exception?

No. No exceptions whatsoever. Otherwise, it wouldn't be a Law.


How exception subclass is created in java?

To handle the exceptions in large programs


What is checked exception?

A compiler for the Java programming language checks, at compile time, that a program contains handlers for checked exceptions, by analyzing which checked exceptions can result from execution of a method or constructor. For each checked exception which is a possible result, the throws clause for the method or constructor must mention the class of that exception or one of the superclasses of the class of that exception. This compile-time checking for the presence of exception handlers is designed to reduce the number of exceptions which are not properly handled.