Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package javaapplication5;
- class Mathmetic{
- public void multiply(int a, int b){
- int multiply = a * b;
- System.out.println("Multiply Result:"+multiply);
- }
- }
- class Algebra extends Mathmetic{
- public void division(int a, int b){
- try {
- int divideBy = a / b;
- System.out.println("Division Result:"+divideBy);
- } catch (ArithmeticException e) {
- System.out.println("ArithmeticException => " + e.getMessage());
- }
- }
- }
- class ExceptionHandling {
- public static void main(String[] args) {
- Algebra obj = new Algebra();
- obj.division(50, 0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement