user defined subclass of throwable class

user defined subclass of throwable class

Dear Sir,pls help me to write this pgm:

Program to illustrate the use of user defined subclass of throwable class
View Answers

July 3, 2010 at 3:02 PM

Hi Friend,

Try the following:

1)
public class ThrowableClass {
public ThrowableClass() {}
public void execute() throws MyException {
int i=9;
int j=0;
int result=i/j;
System.out.println(result);
}
public static void main(String [] args) {
ThrowableClass t = new ThrowableClass();
try {
t.execute();
} catch(MyException e) {
System.out.println(e);
}
}
}

class MyException extends Throwable {}


2)
public class ThrowableClass {
public static void main(String args[]) {
try {
int i=9;
int j=0;
int result=i/j;
System.out.println(result);

} catch(Throwable t) {
System.out.println(t);
}
}
}

Hope that it will be helpful for you.
Thanks









Related Tutorials/Questions & Answers:
user defined subclass of throwable class - Java Beginners
user defined subclass of throwable class  Dear Sir,pls help me to write this pgm: Program to illustrate the use of user defined subclass of throwable class  Hi Friend, Try the following: 1) public class
user defined date class
user defined date class  Develop a user defined date class with public.Fill the members using existing class method.implement the methods for finding current date(),days between method,advanced days and after days
Advertisements
user defined date class
user defined date class  Develop a user defined date class with public.Fill the members using existing class method.implement the methods for finding current date(),days between method,advanced days and after days
USER DEFINED CLASS
USER DEFINED CLASS  hi please help me with my project: Exercise # 1 Create a java program for a class named MyDate that contains data members and a constructor that meet the criteria in the following list. This class is used
Use of Throwable Class
Use of Throwable Class Throwable class is the super class of all... are derived from throwable class. To create your own class of throwable objects, you need to declare it as a subclass of some member of the Throwable family
Using a user defined non-packaged servlet class in jsp. - JSP-Servlet
Using a user defined non-packaged servlet class in jsp.  i want know that how to use a user defined java servlet function's, variables and methods of a user defined java servlet in jsp.if possible plz try to explain with a simple
User Defined Exception In Java
for defining a user defined exception your exception class should be the subclass...User Defined Exception In Java In terms of programming when we talk about.... Then you will be required to create your own exception. A user defined exception can
user defined function inside a jsp
user defined function inside a jsp  how to write a user defined function inside a jsp page
Java User-defined Exception
Java User-defined Exception In this tutorial, you will learn about the User-defined Exceptions. These custom exceptions actually all the programmer... a user defined exception if the student marks entered, is less than fifteen
write a program to create a user defined
write a program to create a user defined   plz send me code   Hi Friend, Please specify what do you want to create?ADS_TO_REPLACE_1 Thanks
verfication of user login and then redirecting it to user defined page
verfication of user login and then redirecting it to user defined page ...() to redirect to a user defined page..but..wen i press the submit button,the html page calls teh servlet..but..the servlet.is not redirecting to a user defined
User defined package problem - Java Beginners
User defined package problem  Hello friend, i was trying to execute the user-defined packages according to the chart that has been given in the Complete-Reference Book of JAVA.in that class-members access protection table
user defined styles for datetimepicker in struts2
user defined styles for datetimepicker in struts2  Hi, sample code: <%@taglib prefix="sx" uri="/struts-dojo-tags"%> Issue: I need to have my own styles for the displyed date picker. is it possible? Can anyone help
user defined styles for datetimepicker in struts2
user defined styles for datetimepicker in struts2  Hi, I am using dojo plugin for displaying datetimepicker. i want to change the colour of the date picker which is in "blue" by default . Please any one can help me
Making Custom (User Defined) Exceptions
Making Custom (User Defined) Exceptions   ... Making Custom (User Define Exceptions) So far you would have been known, how... exception in the Java API, you can code a class that defines an exception that is more
Abstract Class in Java
be defined in the subclass. Points of Abstract class : Abstract class may or may.... It cannot be instantiated but can be extended into subclass. Abstract class cannot... an abstract class is extended into subclass, the subclass provides an implementation
ModuleNotFoundError: No module named 'django-user-defined-fields'
ModuleNotFoundError: No module named 'django-user-defined-fields'  Hi...: No module named 'django-user-defined-fields' How to remove the ModuleNotFoundError: No module named 'django-user-defined-fields' error? Thanks
ModuleNotFoundError: No module named 'mkdocs-user-defined-values'
ModuleNotFoundError: No module named 'mkdocs-user-defined-values'  Hi...: No module named 'mkdocs-user-defined-values' How to remove the ModuleNotFoundError: No module named 'mkdocs-user-defined-values' error? Thanks
ModuleNotFoundError: No module named 'pyjxslt-user-defined-address'
ModuleNotFoundError: No module named 'pyjxslt-user-defined-address'  ...: No module named 'pyjxslt-user-defined-address' How to remove the ModuleNotFoundError: No module named 'pyjxslt-user-defined-address' error
ModuleNotFoundError: No module named 'django-user-defined-fields'
ModuleNotFoundError: No module named 'django-user-defined-fields'  Hi...: No module named 'django-user-defined-fields' How to remove the ModuleNotFoundError: No module named 'django-user-defined-fields' error? Thanks
PHP User Defined Function
PHP User Defined Function An user-defined function saves  us from  rewriting the same code again and again and helps us to make our application... functions as per the need. General structure of the user defined function is:ADS
JavaScript User Defined Functions
JavaScript User-Defined Functions: An user-defined function saves  us from  rewriting the same code again and again and helps us to make our... can make your own as per the need. General structure of the user defined
Remove attribute in user defined session - JSP-Servlet
Remove attribute in user defined session  Hi, How we can set remove attribute for user defined session. I am appreciating if you are sending solution as soon as possible? Thanks, Sanat Kumar
URGENT: User Defined Classes - Java Beginners
URGENT: User Defined Classes  Can someone help me? Design and implement the class Day that implements the day of the week in a program. The class... the definitions of the methods to implement the operations for the class Day, as defined
to make a google map point to user defined location
to make a google map point to user defined location  Hi, i wish to develop an google map,that takes the input from a form(city,area &Country... the desired location of the user
Java Exception Class Hierarchy Diagram
class. The class Exception and its subclasses are defined in such a way that an application may generate a condition which might be caught. The Exception class extends the Throwable class. All errors and exception classes are the subclasses
jsp- adding user defined functions to a jsp
jsp- adding user defined functions to a jsp  Trying to write the function as below but getting errors. Can you please identify the cause of error and how to correct it. <% public String retrieveAndClearErrorMessage
Can a abstract class be defined without any abstract methods?
Can a abstract class be defined without any abstract methods?   hi, Can a abstract class be defined without any abstract methods? thanks
Is there a data structure like a class that doesn't need to be defined as a class in it's own file?
Is there a data structure like a class that doesn't need to be defined as a class in it's own file?  I am new to java, and I am trying to make... ArrayLists easier. For example, I want to create the class Equipment which
Java Error
that occurs in a program. Error in java is a subclass of the Throwable class... is a "normal" condition. It is also a subclass of Error class as most... in the throws clause any subclass of the Error class that might be thrown during
How to create file and save it into user defined path using jsp/servlet?
How to create file and save it into user defined path using jsp/servlet?  Hi.. Onclick event I have created one file.When file will create it should asked where to save file(like browse option
class
class  Is a class a subclass of itself
User Defined Exception
-defined exceptions. This Exception class inherits all the method from Throwable... User Defined Exception     ... The Exception class and its subclass in java is not able to meet up
User Defined Exception
-defined exceptions. This Exception class inherits all the method from Throwable... User Defined Exception     ... The Exception class and its subclass in java is not able to meet up
Sub-class in java
a super class and subclass definition and achieved through the object creation... class and subclass. -- Inheritance allows a new class known as the sub-class... Sub-class in java      
How to access Subclass?
How to access Subclass?  How to access subclass in java? please tell me the syntex with an example
Access the User's node and Retrieve the Preference Information in Class
will learn how to access the user's node and retrieve the stored information in the class. Here we are going to make it easier to understand by the complete... of the access user's preference node and and retrieving all information
Use of Local Inner class
class. Such a class is defined as Nested Class or Local Inner class. The Nested... classes that are not defined static. This class is defined also as Inner class. The Inner class is defined as local Inner class when you declare a inner class
Super class of an Exception class
Super class of an Exception class  hello,,, What is super class of an Exception class?   hii,,ADS_TO_REPLACE_1 the super class of an exception is throwable class. and the super class of an throwable class
Object Class Methods in Java
or indirectly. There are many methods defined in java.lang.Object class..._TO_REPLACE_8 8. wait() Method:- Wait() Method is a defined inside the object class...We are going to discus about Object Class Methods in Java
Exception Classes
; The hierarchy of exception classes commence from Throwable class which... by the program. The throwable class is further divided into two subclasses :- ... of the Throwable family. Also the throwable classes which are defined by you must
Java Nested Class
Java Nested Class         In Java programming language, when a class is defined within another class then such a class is called a nested class. Nested classes are a feature
ModuleNotFoundError: No module named 'subclass-register'
ModuleNotFoundError: No module named 'subclass-register'  Hi, My... named 'subclass-register' How to remove the ModuleNotFoundError: No module named 'subclass-register' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'subclass-register'
ModuleNotFoundError: No module named 'subclass-register'  Hi, My... named 'subclass-register' How to remove the ModuleNotFoundError: No module named 'subclass-register' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'init_subclass'
ModuleNotFoundError: No module named 'init_subclass'  Hi, My... 'init_subclass' How to remove the ModuleNotFoundError: No module named 'init_subclass' error? Thanks   Hi, In your python
doubt about superclass reference and subclass object
doubt about superclass reference and subclass object  class superclass { p.bark() } class subclass extends superclass { p.bark } {p.s.v.m() superclass refvar = new subclass(); p.bark(); } Now my questions 1.Why is necessary
What is the flaw with the Stack class?
There is a flaw in the current stack class and it has become a matter... immediately while for some it can be coped with. Class java.util.Stack... a subclass of Vector, it also inherits all the methods that Vector defines.ADS
ptor is not defined
ptor is not defined  Hi, I am trying to use the protractor for HTML test cases. Due to some reason it is giving error ptor is not defined. How to resolve ptor is not defined error? Thanks   Hi, If you are still
a multithreaded program by creating a subclass of Thread
a multithreaded program by creating a subclass of Thread  I want...: concurrent thread1: programming class ThreadSynchronization...); } } class MyThread extends Thread { static String message
Excel User Define Error Message
Excel User Define Error Message In this section, you will learn , while cell value validation,  how to show user defined error message using Apache POI...); dataValidation.createErrorBox("Invalid Data", "User Defined Msg->

Ads