how to wrire a class which produces only one object.
will that be done by declaring class as a synchronized
will that be done by declaring class as a synchronized
> will that be done by declaring class as a synchronized
No.
Read up on the singleton pattern.
E.g. here:
http://en.wikipedia.org/wiki/Singleton_pattern
And don't bother with any fancy "oh, this factory method allows for lazy loading of your singleton" either. Keep it simple!