how can i synchronize any method or constructor in java by using socket

That question doesn't seem to make any sense. Pleae explain exactly what you want to do.

"you can't."

Never say never...

        Socket synchSocket = new Socket();
        synchronized (synchSocket) {
            // etc
        }

Although I'm pretty sure that's not what he means

:)

means if i make a method in my project for example any frame with textbox then how would i synchronize that to another pc socket

So this is just another way to continue your previous topic? SInce you ignored the advice in that one, and continued to ask pointless questions without enough information, I don't think you will do any better in this thread unless you improve your approach.

technically that doesn't synch the method, only a code block inside the method ;)

so you want some mechanism to synchronise content displayed in instances of your application over a network.
Why didn't you just say so. Completely different question...

And one that has a multitude of potential solutions, some more reliable than others, some faster than others, some easier to implement than others.

But first you'll need to learn to ask the right questions, and ask them in the correct way. Which means showing some research into the topic, not some blanket request for people to do your thinking and coding for you.