why people bother to interview here (Part 1)
I have just gotten out of yet another interview with a “senior” Java candidate who doesn’t know threading at all. Please don’t claim you are a senior candidate unless you can answer this basic question.
If 4 threads are each entering each of the methods below at exactly the same time, how do they interact?
public class classy {
public static synchronized f() { /* do nothing */ }
public synchronized g() { /* do nothing */ }
public static h() { /* do nothing */ }
public i() { /* do nothing */ }
}
No, the answer is not going to be given. It is simply unbelievable how many candidates have failed this test miserably. Don’t be one of them!
This post is labeled Part 1 because there will be more rants in this area I am sure!