|
1. What is the Locale class? The Locale class is used to tailor program output to the conventions of a particular geographic, political, or cultural region. 2. What method is invoked to cause an object to begin executing as a separate thread? The start() method of the Thread class is invoked to cause an object to begin executing as a separate thread. 3. What happens when a thread cannot acquire a lock on an object? If a thread attempts to execute a synchronized method or synchronized statement and is unable to acquire an object's lock, it enters the waiting state until the lock becomes available. 4. What is the purpose of the System class? The purpose of the System class is to provide access to system resources. 5. What is an object's lock and which object's have locks? An object's lock is a mechanism that is used by multiple threads to obtain synchronized access to the object. A thread may execute a synchronized method of an object only after it has acquired the object's lock. All objects and classes have locks. A class's lock is acquired on the class's Class object. 6. What restrictions are placed on the values of each case of a switch statement? During compilation, the values of each case of a switch statement must evaluate to a value that can be promoted to an int value. 7. How are the elements of a CardLayout organized? The elements of a CardLayout are stacked, one on top of the other, like a deck of cards. 8. Is "abc" a primitive value? The String literal "abc" is not a primitive value. It is a String object. 9. Which TextComponent method is used to set a TextComponent to the read-only state? setEditable() 10. What is the difference between the String and StringBuffer classes? String objects are constants. StringBuffer objects are not. 11. Which Java operator is right associative? The = operator is right associative. 12. What is the relationship between the Canvas class and the Graphics class? A Canvas object provides access to a Graphics object via its paint() method. 13. Can a double value be cast to a byte? Yes, a double value can be cast to a byte. 14. What is the difference between the Reader/Writer class hierarchy and the InputStream/OutputStream class hierarchy? The Reader/Writer class hierarchy is character-oriented, and the InputStream/OutputStream class hierarchy is byte-oriented. 15. Does a class inherit the constructors of its superclass? A class does not inherit constructors from any of its superclasses.
|