Tim Driven Development | Test until the fear goes away
No.Sucheta Shrivastavas wrote:. . . (is this the answer to what you talking about ?)
Have you looked up the details of that Exception? The documentation gives you all the details you need to know. If you don't understand them, please ask again.Sucheta Shrivastava wrote:. . . InvalidClassException.
No, I gave a solution which will supply a different ID for each object. As Tim has already told you, you are not using multiple objects (at least you weren't in the first version.2.The solution you provided to increment the id as . . . is giving an errneous output - id s remaining the same for all outputs. . . .
The mistake wasn't repeating the ++ call. Having it there at all is the real mistake.Sucheta Shrivastava wrote:. . . 1. I am sorry to repeat the "id ++" twice. sorry my mistake.
I know that, but it should be called SomethingException.2. I am throwing an Exception. That is a user-defined exception . . .
That is not the correct way to create an Exception class. Look in the Java™ Tutorials for a bit of advice, but in 99% of cases all you need is constructors; the code should look like this:-You may wish to implement the 5th constructor, too.. . .
It says extends XYZException in the code. You create the XYZException class similarly.Sucheta Shrivastava wrote:. . . you have written super. so there need to be a parent class to validate the super. where will it come frm. . . .
The fact that you can get something to run doesn't necessarily make it correct.My class i created BeyondTheSpecifiedLength exception is working.
I didn't say it. I'm just telling you what this tiny ad said.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|