The objArray is a placeHolder to hold the valuewhy would you want to add more objects or error codes to it after the exception is raised? sounds like a recipe for disaster
objects involved while the exception had occured.
Initially the Exception object is constructed and
thrown to the upper layer.
If at all I want to add some more objects/error codes
for this exceptions I have some place to put. That is
the main purpose of the array.
As you stated this is a kind of design issue. If it
would have had a setter method to set the
objectArray, then my problem is solved.
But my problem is I don't know whether an Exceptiontechnically there is nothing to stop you doing it, no. the fact that nobody else does should give you a clue as to its appropriateness though :-)
class can have a setter method or not.
I have searched in Jave API. None of the Exception
classes has the setter method. So only I got this
doubt. I just would like to know the reason behind
If at all they did not have this setter methods justdo it if you will, it's your code. I doubt there's many people would think it's a good idea, and I bet it ends up overcomplicating your code exponentially.
for a consistance, and if there will not be any harm
to have a setter method then I can add one.
Thanks for your quick response.