A server reads its settings as key = value lines (empty lines and lines starting with # are ignored). Valid keys are port, threads and timeout, with defaults 8080, 4 and 30.
- Write a checked exception
ConfigException extends Exceptionthat stores the line number; its message isline 3: …. - Write
static int[] load(Scanner in) throws ConfigExceptionthat throws it for: a missing=, an unknown key, a value that is not a whole number (catch theNumberFormatExceptionand translate it:timeout must be a whole number, got 'ten') and a value ≤ 0. maincallsload, prints the three settings andConfiguration OK, orConfiguration error, line 2: unknown key 'host'; afinallyblock closes the Scanner and prints(input closed).