EXCEPTIONS

EXCEPTIONS

View Answers

September 3, 2009 at 5:43 PM

Hi Friend,

You can use throws clause.For ex:

class MyException extends Exception {
public MyException(String msg){
super(msg);
}
}

public class Test {

static int divide(int first,int second) throws MyException{
if(second==0)
throw new MyException("can't be divided by zero");
return first/second;
}

public static void main(String[] args)throws MyException {
System.out.println(divide(4,0));

}
}

Thanks









Related Tutorials/Questions & Answers:
exceptions
exceptions  why we get compiletime exceptions(checkedExeption)? forEg:IOException,servletException
ModuleNotFoundError: No module named 'exceptions'
ModuleNotFoundError: No module named 'exceptions'  Hi, My Python... 'exceptions' How to remove the ModuleNotFoundError: No module named 'exceptions' error? Thanks   Hi, In your python environment you
Advertisements
ModuleNotFoundError: No module named 'exceptions'
ModuleNotFoundError: No module named 'exceptions'  Hi, My Python... 'exceptions' How to remove the ModuleNotFoundError: No module named 'exceptions' error? Thanks   Hi, In your python environment you
how to deal with exceptions in servlet
how to deal with exceptions in servlet  plz give me the reply
Exceptions in java
Exceptions in java       Exceptions are used for handing errors and other exceptional events in Java programming language.Exception: Exceptions are abnormal or special conditions
exceptions in java - Java Beginners
exceptions in java  can any one explain exceptions with example... the normal flow of execution of a program. Exceptions are used for signaling...://www.roseindia.net/java/exceptions/ Thanks
Java Exception - Handle Exceptions in Java
Java Exception - Handle Exceptions in Java... to handle the Exceptions in Java programming language. This section on exception.... You will also learn how to create your own exceptions in your Java program
How to solve the Hibernate Common Exceptions?
How to solve the Hibernate Common Exceptions?  How to solve the Hibernate Common Exceptions
JSP handle runtime exceptions
JSP handle runtime exceptions  How does JSP handle runtime exceptions?   Using errorPage attribute of page directive and also we need to specify isErrorPage=true if the current page is intended to URL redirecting
EXCEPTIONS-----1 - Java Interview Questions
EXCEPTIONS-----1  How To Handle The Exceptions With Out Using Try,Catch And Throws?I Want Region Plz Post Answer
Exceptions in RMI - RMI
Exceptions in RMI  During the execution of RMI program, the following exception is raised. Error.. java.rmi.ServerException : ServerRemoteException : nested exception is java.rmi.UnmarshalException : error unmarshalling  
ModuleNotFoundError: No module named 'asphalt-exceptions'
ModuleNotFoundError: No module named 'asphalt-exceptions'  Hi, My... named 'asphalt-exceptions' How to remove the ModuleNotFoundError: No module named 'asphalt-exceptions' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'coded_exceptions'
ModuleNotFoundError: No module named 'coded_exceptions'  Hi, My... named 'coded_exceptions' How to remove the ModuleNotFoundError: No module named 'coded_exceptions' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'django-exceptions'
ModuleNotFoundError: No module named 'django-exceptions'  Hi, My... named 'django-exceptions' How to remove the ModuleNotFoundError: No module named 'django-exceptions' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'Flask-Exceptions'
ModuleNotFoundError: No module named 'Flask-Exceptions'  Hi, My... named 'Flask-Exceptions' How to remove the ModuleNotFoundError: No module named 'Flask-Exceptions' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'Flask-Exceptions'
ModuleNotFoundError: No module named 'Flask-Exceptions'  Hi, My... named 'Flask-Exceptions' How to remove the ModuleNotFoundError: No module named 'Flask-Exceptions' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'Flask-Exceptions'
ModuleNotFoundError: No module named 'Flask-Exceptions'  Hi, My... named 'Flask-Exceptions' How to remove the ModuleNotFoundError: No module named 'Flask-Exceptions' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'lanfit-exceptions'
ModuleNotFoundError: No module named 'lanfit-exceptions'  Hi, My... named 'lanfit-exceptions' How to remove the ModuleNotFoundError: No module named 'lanfit-exceptions' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'logging-exceptions'
ModuleNotFoundError: No module named 'logging-exceptions'  Hi, My... named 'logging-exceptions' How to remove the ModuleNotFoundError: No module named 'logging-exceptions' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'makecents-exceptions'
ModuleNotFoundError: No module named 'makecents-exceptions'  Hi...: No module named 'makecents-exceptions' How to remove the ModuleNotFoundError: No module named 'makecents-exceptions' error? Thanks   Hi
ModuleNotFoundError: No module named 'retry_on_exceptions'
ModuleNotFoundError: No module named 'retry_on_exceptions'  Hi, My... named 'retry_on_exceptions' How to remove the ModuleNotFoundError: No module named 'retry_on_exceptions' error? Thanks   Hi
ModuleNotFoundError: No module named 'rpc_exceptions'
ModuleNotFoundError: No module named 'rpc_exceptions'  Hi, My... named 'rpc_exceptions' How to remove the ModuleNotFoundError: No module named 'rpc_exceptions' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'asphalt-exceptions'
ModuleNotFoundError: No module named 'asphalt-exceptions'  Hi, My... named 'asphalt-exceptions' How to remove the ModuleNotFoundError: No module named 'asphalt-exceptions' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'better-exceptions'
ModuleNotFoundError: No module named 'better-exceptions'  Hi, My... named 'better-exceptions' How to remove the ModuleNotFoundError: No module named 'better-exceptions' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'coded_exceptions'
ModuleNotFoundError: No module named 'coded_exceptions'  Hi, My... named 'coded_exceptions' How to remove the ModuleNotFoundError: No module named 'coded_exceptions' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'collect-exceptions'
ModuleNotFoundError: No module named 'collect-exceptions'  Hi, My... named 'collect-exceptions' How to remove the ModuleNotFoundError: No module named 'collect-exceptions' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'common-exceptions'
ModuleNotFoundError: No module named 'common-exceptions'  Hi, My... named 'common-exceptions' How to remove the ModuleNotFoundError: No module named 'common-exceptions' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'django-exceptions'
ModuleNotFoundError: No module named 'django-exceptions'  Hi, My... named 'django-exceptions' How to remove the ModuleNotFoundError: No module named 'django-exceptions' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'easy-exceptions'
ModuleNotFoundError: No module named 'easy-exceptions'  Hi, My... named 'easy-exceptions' How to remove the ModuleNotFoundError: No module named 'easy-exceptions' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'Flask-Exceptions'
ModuleNotFoundError: No module named 'Flask-Exceptions'  Hi, My... named 'Flask-Exceptions' How to remove the ModuleNotFoundError: No module named 'Flask-Exceptions' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'giz-exceptions'
ModuleNotFoundError: No module named 'giz-exceptions'  Hi, My... named 'giz-exceptions' How to remove the ModuleNotFoundError: No module named 'giz-exceptions' error? Thanks   Hi, In your python
interfaces,exceptions,threads
interfaces,exceptions,threads  SIR,IAM JAVA BEGINER,I WANT KNOW THE COMPLETE CONEPTS OF INTERFACES,EXCEPTIONS,THREADS   Interface.../interface.shtml   Exceptions Exception are such anomalous conditions
Core Java Exceptions - Java Beginners
Core Java Exceptions  HI........ This is sridhar .. Exceptions r checked exception and unchecked exception ........? Checked exceptions r at compile time and Unchecked exceptions r runtime? but Exception is Runtime
Chapter 12. Exceptions
exceptions to inform the client of abnormal application-level conditions.... Application exceptions are not intended for reporting system-level problems... exceptions. These exceptions are used as standard application exceptions
JSP handle run-time exceptions
JSP handle run-time exceptions  How does JSP handle run-time exceptions?   You can use the errorPage attribute of the page directive to have uncaught run-time exceptions automatically forwarded to an error processing
Java Exceptions Tutorials With Examples
Java Exceptions Tutorials With Examples       Exceptions in Java Exceptions... the execution of the program. Exceptions are the conditions or typically an event
ModuleNotFoundError: No module named 'ctodd-python-lib-exceptions'
ModuleNotFoundError: No module named 'ctodd-python-lib-exceptions'  ...: No module named 'ctodd-python-lib-exceptions' How to remove the ModuleNotFoundError: No module named 'ctodd-python-lib-exceptions' error? Thanks
ModuleNotFoundError: No module named 'ctodd-python-lib-exceptions'
ModuleNotFoundError: No module named 'ctodd-python-lib-exceptions'  ...: No module named 'ctodd-python-lib-exceptions' How to remove the ModuleNotFoundError: No module named 'ctodd-python-lib-exceptions' error? Thanks
ModuleNotFoundError: No module named 'django-extra-exceptions'
ModuleNotFoundError: No module named 'django-extra-exceptions'  Hi...: No module named 'django-extra-exceptions' How to remove the ModuleNotFoundError: No module named 'django-extra-exceptions' error? Thanks   
ModuleNotFoundError: No module named 'djangorestframework-custom-exceptions'
ModuleNotFoundError: No module named 'djangorestframework-custom-exceptions...: ModuleNotFoundError: No module named 'djangorestframework-custom-exceptions' How...-exceptions' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'django-web-exceptions'
ModuleNotFoundError: No module named 'django-web-exceptions'  Hi...: No module named 'django-web-exceptions' How to remove the ModuleNotFoundError: No module named 'django-web-exceptions' error? Thanks   Hi
ModuleNotFoundError: No module named 'django-web-exceptions'
ModuleNotFoundError: No module named 'django-web-exceptions'  Hi...: No module named 'django-web-exceptions' How to remove the ModuleNotFoundError: No module named 'django-web-exceptions' error? Thanks   Hi
ModuleNotFoundError: No module named 'django-web-exceptions'
ModuleNotFoundError: No module named 'django-web-exceptions'  Hi...: No module named 'django-web-exceptions' How to remove the ModuleNotFoundError: No module named 'django-web-exceptions' error? Thanks   Hi
ModuleNotFoundError: No module named 'django-web-exceptions'
ModuleNotFoundError: No module named 'django-web-exceptions'  Hi...: No module named 'django-web-exceptions' How to remove the ModuleNotFoundError: No module named 'django-web-exceptions' error? Thanks   Hi
ModuleNotFoundError: No module named 'django-web-exceptions'
ModuleNotFoundError: No module named 'django-web-exceptions'  Hi...: No module named 'django-web-exceptions' How to remove the ModuleNotFoundError: No module named 'django-web-exceptions' error? Thanks   Hi
ModuleNotFoundError: No module named 'drf-common-exceptions'
ModuleNotFoundError: No module named 'drf-common-exceptions'  Hi...: No module named 'drf-common-exceptions' How to remove the ModuleNotFoundError: No module named 'drf-common-exceptions' error? Thanks   Hi
ModuleNotFoundError: No module named 'odoo8-addon-sale-exceptions'
ModuleNotFoundError: No module named 'odoo8-addon-sale-exceptions'  ...: No module named 'odoo8-addon-sale-exceptions' How to remove the ModuleNotFoundError: No module named 'odoo8-addon-sale-exceptions' error? Thanks
ModuleNotFoundError: No module named 'site-exceptions-handler'
ModuleNotFoundError: No module named 'site-exceptions-handler'  Hi...: No module named 'site-exceptions-handler' How to remove the ModuleNotFoundError: No module named 'site-exceptions-handler' error? Thanks   
ModuleNotFoundError: No module named 'better-exceptions-fork'
ModuleNotFoundError: No module named 'better-exceptions-fork'  Hi...: No module named 'better-exceptions-fork' How to remove the ModuleNotFoundError: No module named 'better-exceptions-fork' error? Thanks   Hi
ModuleNotFoundError: No module named 'better-exceptions-hook'
ModuleNotFoundError: No module named 'better-exceptions-hook'  Hi...: No module named 'better-exceptions-hook' How to remove the ModuleNotFoundError: No module named 'better-exceptions-hook' error? Thanks   Hi

Ads