161. Question: What are synchronized methods and synchronized statements?
Answer: Synchronized methods are methods that are used to control access to 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 lock for the object or class referenced in the synchronized
statement.
162. Question: What are three ways in which a thread can enter the waiting
state?
Answer: A thread can enter the waiting state byinvoking its sleep() method, by
blocking on I/O, 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.
163. Question: Can a lock be acquired on a class?
Answer: Yes, a lock can be acquired on a class. This lock is acquired on the
class's Class object.
164. Question: What's new with the stop(), suspend() and resume() methods in JDK 1.2?
Answer: The stop(), suspend() and resume() methods have been deprecated in JDK 1.2.
165. Question: What is the preferred size of a component?
Answer: The preferred size of a component is the minimum component size that will
allow the component to display normally.
Wednesday, May 7, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment