Untitled
unknown
plain_text
22 days ago
349 B
1
Indexable
Never
public static void trynumber(int n){ try { checkEvenNumber(n); } catch (IllegalArgumentException e) { System.out.print(e.getMessage()); } } public static void checkEvenNumber(int number) throws IllegalArgumentException { if (number % 2 == 1) throw new IllegalArgumentException("Error: "+number + is odd."); else System.out.print(number+" is even.");
Leave a Comment