Advertisement
zoro-10

Pr3a.java

Mar 30th, 2024 (edited)
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.33 KB | None | 0 0
  1. public class Pr3a {
  2.  
  3.   public static void main(String args[]) {
  4.     try {
  5.       int result = divide(10, 0);
  6.       System.out.println("Result:" + result);
  7.     } catch (ArithmeticException e) {
  8.       System.err.println("Error:Division by Zero.");
  9.     }
  10.   }
  11.  
  12.   public static int divide(int a, int b) {
  13.     return a / b;
  14.   }
  15. }
  16.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement