+ 1
How is a person supposed to keep all the specific exceptions straight?
There are so many different kinds.
4 Réponses
+ 1
@Elizabeth Lewis: You can keep the specific exceptions straight by using the Java documentation. You will become more familiar as you write more code.
+ 1
we should use a try to execute the statement nd check whether it's wrong nd if it's wrong catch will excute it's statements
+ 1
You can use the superclass of them: Exception
But if you want to use different codes for different exceptions you dont have to know all of them. some of them are realy rare. Others can be knowed by testing your program and taking xp. Also you can use oracle docs. But remember that if you know some exp types for an issue, others are very similar to them(i man their name).
+ 1
Specific exceptions if handled by the programmer would give the Code a better perspective in the Developer's world. it's good programming practice to be more specific so that these errors can be corrected and the program execution is smoother.
A generic Exception object is almost always recommended at the end of the Catch block to handle any unforeseen errors.
As the programmer gets more and more experienced, the programs get more refined and Good programming practices are inculcated in the Code.