Latest Activity In Study Groups

Join Your Study Groups

VU Past Papers, MCQs and More

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

Suppose you have to write a small Java program that catches exceptions with super classes. You are required to use inheritance to create an exception superclass (called ExceptionA) and exception subclasses ExceptionB and ExceptionC; where ExceptionB inherits from ExceptionA and ExceptionC inherits from ExceptionB. Your program must demonstrate that the catch block for type ExceptionA catches exceptions of types ExceptionB and ExceptionC.


Hint: You can use Arithmetic exception like divide by 0 or any similar one.
NOTE: You are required to use Graphical User Input (GUI) to show output on the screen.

Views: 18312

Attachments:

Replies to This Discussion

ye file h is ka code 100% teak h bx run k output ka screenshot ly k submit kara dyn

Attachments:

Here you go

Attachments:

import javax.swing.JOptionPane; class Exception { public static void main (String args[])
{
String a,b;
int x,y,z;
a=JOptionPane.showInputDialog("Enter First No.");
b=JOptionPane.showInputDialog("Enter 2nd No.");
x=Integer.parseInt(a);
y=Integer.parseInt(b);
z=x/y;
JOptionPane.showMessageDialog(null, x + "/" +y+ "\t is = \t" +z);
System.exit(0);
}
}

RSS

Looking For Something? Search Below

Latest Activity

VIP Member Badge & Others

How to Get This Badge at Your Profile DP

------------------------------------

Management: Admins ::: Moderators

Other Awards Badges List Moderators Group

© 2021   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service