Return to site

[VV123] The Java 21 Newsletter: Certification's exceptions

· java,java21,ocp

Here's a clean and focused Java Exception Tree containing only the exceptions relevant to the Java certifications (like 1Z0-819, 1Z0-830), with a clear emphasis on:

  • ✅ Runtime vs checked
  • ✅ Certification usage context
  • ✅ Avoiding noise from obscure exceptions

🧠 What to Know for Each (Certification-Relevant Exceptions)

  1. 📄 IOException – Checked: File or stream operations, often used in try-with-resources.
  2. 📁 FileNotFoundException – Checked: Thrown when attempting to open a non-existent file.
  3. 📤 EOFException – Checked: End of stream reached unexpectedly during input.
  4. 📦 UncheckedIOException – Unchecked: Wraps IOException in functional interfaces or streams.
  5. 💤 InterruptedException – Checked: Thrown when a thread is interrupted (e.g., during Thread.sleep()).
  6. ⏱️ TimeoutException – Checked: Occurs when waiting too long for a task to complete (e.g., Future.get() with timeout).
  7. 💥 ExecutionException – Checked: Wraps exceptions thrown in async tasks (e.g., from Future).
  8. 🔍 InvocationTargetException – Checked: Thrown when a reflected method throws an exception.
  9. 🔐 IllegalAccessException – Checked: Reflection access to a field/method is illegal.
  10. 🧱 InstantiationException – Checked: Attempt to instantiate an abstract class or interface via reflection.
  11. 🧭 NoSuchMethodException – Checked: Requested method does not exist (common in reflection).
  12. 🌍 MissingResourceException – Unchecked: Missing key in a ResourceBundle.
  13. ArithmeticException – Unchecked: Arithmetic error, like division by zero.
  14. NullPointerException – Unchecked: Dereferencing a null reference.
  15. 📉 IndexOutOfBoundsException – Unchecked: General out-of-bounds for collections/arrays.
  16. 🧮 ArrayIndexOutOfBoundsException – Unchecked: Specifically for arrays.
  17. ✂️ StringIndexOutOfBoundsException – Unchecked: Specifically for strings.
  18. 🧪 IllegalArgumentException – Unchecked: Invalid method parameter passed.
  19. 🔢 NumberFormatException – Unchecked: Failed conversion from string to number (e.g., "abc" to int).
  20. 🌀 IllegalStateException – Unchecked: Method invoked at an inappropriate time (e.g., reusing a closed stream).
  21. 🔄 ClassCastException – Unchecked: Invalid casting between incompatible types.
  22. 🚫 UnsupportedOperationException – Unchecked: Operation not supported, such as on unmodifiable collections.
  23. 🔁 ConcurrentModificationException – Unchecked: Modifying a collection during iteration.
  24. 📝 InputMismatchException – Unchecked: Scanner receives input of unexpected type.
  25. 📭 NoSuchElementException – Unchecked: Accessing elements from an exhausted iterator or empty optional/stream.
  26. 🛡️ SecurityException – Unchecked: Access control violation (e.g., attempting a restricted operation).