Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ExeptionUse {
- private static int pa;
- private static int pb;
- public ExeptionUse(int a, int b) {
- // TODO Auto-generated constructor stub
- this.pa = a;
- this.pb = b;
- }
- public ExeptionUse(){
- // TODO Auto-generated constructor stub
- this.pa = 0;
- this.pb = 0;
- }
- private static int Divide(int a, int b) {
- return a/b;
- }
- public static void exeption(int a, int b) {
- int result = 0;
- try {
- result = Divide(a,b);
- }catch (ArithmeticException e) {
- throw new MyExeption("\n\tDivision by 0!!");
- }finally{
- System.out.printf("Result is: %d",result);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement