1. Learn
  2. /
  3. Courses
  4. /
  5. Data Types and Exceptions in Java

Connected

Exercise

Logging APIs

Use Java Logging to track what's happening in a Java bill splitting application.

Instructions

100 XP
  • Add the import statement with the package containing Java's logging capability.
  • Create a Logger object from the Logger class and name it after the class it is in.
  • Log the bill amount for each person as computed in computeEachBill() with log level INFO.
  • Log the exception when the number of persons entered is not positive in the catch block of computeEachBill() with log level SEVERE.