THINK FIRST·CODE LATER

← All labs

TimeFormatException: a custom checked exception

Problem

Write a checked exception TimeFormatException and a method parseTime(String) that accepts hh:mm, returns the hours and minutes, and throws the exception with a helpful message when the format or the range is wrong.

Write it here or in your IDE, then paste it. Compile and test it yourself before comparing. Your code stays in your browser — it is never sent to or stored on the server.