1Z0-809 · Question #121
Which two are Java Exception classes?
The correct answer is A. SercurityException C. IllegalArgumentException. A (SecurityException) and C (IllegalArgumentException) are both real classes in the java.lang package - SecurityException is thrown when a security violation occurs (e.g., insufficient permissions), and IllegalArgumentException is thrown when a method receives an argument of an…
Question
Options
- ASercurityException
- BDuplicatePathException
- CIllegalArgumentException
- DTooManyArgumentsException
How the community answered
(20 responses)- A80% (16)
- B15% (3)
- D5% (1)
Explanation
A (SecurityException) and C (IllegalArgumentException) are both real classes in the java.lang package - SecurityException is thrown when a security violation occurs (e.g., insufficient permissions), and IllegalArgumentException is thrown when a method receives an argument of an inappropriate value.
Note that option A contains a typo ("Sercurity" instead of "Security") - on a real exam, watch for this kind of distractor; the intended class is java.lang.SecurityException.
B (DuplicatePathException) and D (TooManyArgumentsException) do not exist in the Java standard library; they are plausible-sounding fabrications designed to test whether you know the actual API.
Memory tip: Both real answers come from java.lang, Java's always-imported core package. If an exception name sounds legitimate but you can't place its package, it's likely a fake - Java's standard exceptions follow consistent naming patterns like IllegalXxxException, UnsupportedXxxException, and SecurityException.
Community Discussion
No community discussion yet for this question.