Your code has several race conditions and dead-locks (which explains why GregBrannon got "desired" results and you didn't).
1. You're synchronizing on different objects. Thus every thread is allowed through the synchronized block( a.k.a. it does nothing but hurt performance).
2.
// initially: can_go = true
while (!can_go) {
wait(); // release the lock of this object
}
can_go = false;
Multiple threads could reach the compare statement at the same time. They would determine can_go == true, and skip the while loop. These concurrent threads then all set can_go to false. However, multiple threads don't have to pass the while loop at the same time. If any thread gets trapped in this while loop, they will dead-lock, never to finish because no other thread will ever notify that thread (they all notify their own unique thread objects).
At this point, you have entered undefined land, where your computer is allowed to catch fire spuriously. Writes can over-ride writes, two writes could combine their bits and give garbage results, or worse of all nothing could go wrong until you release your program and planes start falling out of the sky (a bit of an exaggeration, but multi-threaded programs are extremely hard to debug after-wards so we do our best to encourage programmers to get it right the first time
).
Personally, I wouldn't use any locking here at all, but I would use atomics. However, they are generally harder to get right so we'll ignore that they exist for now.
What you need to do is have a common object you can synchronize on. Since synchronized blocks guarantee mutual exclusion, using an extra boolean variable is just asking for trouble. You're very likely to end up with dead-locks, data races, or all sorts of nastiness.
Here's a simplistic fixed solution (not a full solution, but it's very close to a complete solution):
class MyBetterThread extends Thread {
private static Object my_lock = new Object();
public void incrementby(int j)
{
synchronized(my_lock)
{
// this section is now guarded by mutual exclusion, a.k.a. guaranteed only one thread will be in here
// do your work here
}
}
}