Hi,
I'm not 100% sure i understand your question. When you use the "new" keyword you are instantiating a new instance of an object. So //1 & //2 are different instances.
With regards to the lock on dostuff... first of all your class doesn't compile (pubic == public) second you must implement the run() method (not the Run() method) and third you are not try to access do stuff in this program. To do so you need to do one of 2 things:
1. Call the run() method from the class, this will cause it to be a regular method call and no new threads will spawn.
2. You can wrap your class with a
Thread object and call the start() method on that object (see
Sun guide), this will span 2 separate threads that will call dostuff synchronously (because you used the synchronized key
word on the method) so there won't be a deadlock or a race condition....
hope that helps...