Originally posted by subhadeep chakraborty:
1) why are wait(), notify() and notifyAll() in the Object class although we use it only while threading?
So you can synchronize on any object you wish to, since all objects will inherit those methods. If it were methods of
Thread then you could only synchronize on the thread.
2) why can't static and transient variables be serialized?
The transient keyword is invented just to prevent the variable from being serialized. Sometimes a variable isn't serializable, but you can reconstruct it from other information (such as an InputStream). Without the transient keyword the entire object would be non-serializable.
As for static - it's an instance of a class that is serialized. Static variables are not related to the instance but the entire class. If you would deserialize it, there is still the existing information in the static variable.
3) what is the difference between a argument and parameter?
I think it's just a matter of name calling. I mix them up myself sometimes.