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?
Mohd Abrar Khan
Joined: Jan 20, 2010
thanks for your time,
Tim, i have no idea how the Dog class is changing,
i have tried running the same programme in Netbeans IDE, its giving correct output there,
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.