EXCEPTION HANDLING IN JAVA

Write a method that accepts two integer prime numbers and returns their product. If either argument is not prime, throw a custom PrimeNumberException and report the number(s) that are not prime. Your custom exception should be a checked exception. In addition to the above, write some code to show how your method works when called with the following arguments:

  • Two prime numbers
  • One prime and one non-prime number
  • Two non-prime numbers