Abhi Venu wrote:1.what are the disadvantages in usage of Runnable interfaces over extending a Thread class to create a thread?
Are there any? Perhaps the usage of an extra object is the only one - one Runnable plus one Thread instead of only one Thread. For the rest there are only advantages. See also
Extending Thread Vs Implementing Runnable.
2. Can static variables in a class be searialised?
If they are serializable, but only if you serialize them yourself. They aren't serialized when you serialize an instance (after all, it's not an instance variable), but nothing prevents you from using writeObject with a static field.
3.If a class A has two variables AB,AC
A subclass of A ie B has two varaibles BC,BD and also it implements serializable interface
a method is called on a object of type B to searilize it ? will it work correctly or cause erorrs as i[/color]ts parent c
If class A is not serializable then AB and AC will not be serialized, and not be serialized. In this case the constructor without parameters will be called for class A. If there is none then an exception will be thrown.
Try it:
Try this, then remove the first constructor from class A and try again.