This article lays down some of the best practices which you can use during your design or code reviews, and assumes that you are familiar with the basics of exceptions in Java. Exceptions should be only used for exceptional conditions. It should not be used for control flow using techniques that might look very clever, like catching an exception and ending a loop.
Let us do a simple hands on excercise followed by some questions to understand exceptions better. For theory and concetps of exceptions in Java. you can refer to the note introduction-to-exceptions-in-java.
Create a class MyClass and create three methods myMethod1(), Method2() and Method3().
Invoke Method2() from Method1() and Method3() from Method2().
This is a personal technical blog where we share our understanding on various concepts and is neither an official page or documentation for the products described here, nor the official views of the companies we work with.
Keywords used in this website are trademarks of their respective owners. This website is not affiliated with Oracle™ and/or any of the JEE frameworks like Spring™, Struts™, Hibernate™ and JSF™.
All contents and materials are provided freely without any warranty or liability and nothing within the site should be considered as professional advice. In any doubt, please ask, and we will try to help you based on our knowledge. Please let us know if you feel anything is not right here (including any copyright violation) and we will act upon it as fast as we can.