So I have created a program which involves the use of exceptions. This seems to be working fine apart from I am getting unwanted error pointers within the output of my code. Here is the output of my code:
************Herbivore caught Exception example************
java.lang.Exception: Herbivores only eat plants!
Exception caught
************Herbivore non-caught Exception example************
Herbivores eat Vegetables
at QuestionEditor.Rabbit.eat(Rabbit.java:38)
at QuestionEditor.Main.main(Main.java:25)
I don't want the last two lines of the output within my code because that is just telling me why I am getting an exception but I just want to print out the exception message without these additional error message pointers if that's possible? I'm using NetBeans so I'm not sure if this occurs with every exception program o if I have done someting wrong? I didn't think it was necessary to show the code of my program because there is't actually any errors and it is outputting what I want it to be outputting apart form these additional messages, if you think it's important that I include the code please leave a comment saying so and I will edit it in my question. The preferred output would be:
************Herbivore caught Exception example************
java.lang.Exception: Herbivores only eat plants!
Exception caught
************Herbivore non-caught Exception example************
Herbivores eat Vegetables
If anybody could help that would be appreciated, thanks.