Hi,
I'm going through Head First Java and chapter 11 is about Exceptions. One of the examples show using an exception that is non-default I guess. BadException in the first section directly below:
So, mostly because I was curious, I figured out that I needed to create my own class for non-default exceptions and got it working, like this:
Here's my output which seems to be working:
My questions are:
As a newbie Java programmer will it be common that I'll need to create my own Exception classes so that I should spend time learning it? Did I do this correctly? Why didn't "System.out.println("In BadException now");" in my BadException class execute? Plus any general comments that might you might have.
Thanks,
Gary
I'm going through Head First Java and chapter 11 is about Exceptions. One of the examples show using an exception that is non-default I guess. BadException in the first section directly below:
So, mostly because I was curious, I figured out that I needed to create my own class for non-default exceptions and got it working, like this:
Here's my output which seems to be working:
My questions are:
Thanks,
Gary