Entries from September 2010
What would you use to compare two String variables – the operator == or the method equals()?
I’d use the method equals() to compare the values of the Strings and the == to check if two variables point at the same instance of a String object. Read More...
What’s the difference between J2SDK 1.5 and J2SDK 5.0?
There’s no difference, Sun Microsystems just re-branded this version. Read More...
What are three ways in which a thread can enter the waiting state?
A thread can enter the waiting state by invoking its sleep() method, by blocking on IO, by unsuccessfully attempting to acquire an object’s lock, or by invoking an object’s wait() method. It can also enter the waiting state by invoking its (deprecated) suspend() method. Read More...
What are synchronized methods and synchronized statements?
Synchronized methods are methods that are used to control access to a method or an object. A thread only executes a synchronized method after it has acquired the lock for the method’s object or class. Synchronized statements are similar to synchronized methods. A synchronized statement can only be executed after a thread has acquired the Read More...