In this lecture, we’ll cover when and why to create your own exceptions in Java: how to choose between
Exception and
RuntimeException, design constructors with the
String
message and
Throwable
cause parameters, add useful fields, and use them correctly in code. We’ll discuss naming, scope of responsibility, documenting via
throws, and common mistakes. Plus—why it’s sometimes better to throw an exception than return
false.