I could reproduce your error, though, if I compiled another class named Dog after compiling SuperNotSerial. The new Dog will replace the one SuperNotSerial is expecting. As the Error implies, the underlying Dog class somehow changed after you compiled SuperNotSerial. Any ideas on how this happened?
Remember that although serialization is very interesting and useful it's not the the exam for SCJP 6.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
i have another class file which contains a dog Subclass, i have executed this file and its ok,
and currently if i am running this programme which also has a dog class , so does this cause a problem in execution of my current programme
both the files are in same directory location,
Yes sir. This is what I was asking about. the other class file's Dog subclass will replace your other Dog.
A NoSuchMethodError indicates that you have an old class file somewhere in which the indicated method is missing (in your case, it's complaining about a missing constructor in class Dog that takes an int and a String). You have an old version of Dog.class that gets picked up.
Mohd Abrar Khan wrote:Henry thanks i have done that it was giving the same error,
now i have moved the file to a different location and ran it from there its working fine now,
You must have missed something, in the old location or somewhere in your classpath was probably still an old version of Dog.class.