|
1. How are Observer and Observable used? Objects that subclass the Observable class maintain a list of observers. When an Observable object is updated it invokes the update() method of each of its observers to notify the observers that it has changed state. The Observer interface is implemented by objects that observe Observable objects. 2. What is an Iterator interface? The Iterator interface is used to step through the elements of a Collection. 3. Which java.util classes and interfaces support event handling? The EventObject class and the EventListener interface support event processing. 4. Is null a keyword? The null value is not a keyword. 5. Can an anonymous class be declared as implementing an interface and extending a class? An anonymous class may implement an interface or extend a superclass, but may not be declared to do both. 6. Can a for statement loop indefinitely? Yes, a for statement can loop indefinitely. For example, consider the following: for(;;) ; 7. Is sizeof a keyword? The sizeof operator is not a keyword. 8. What's new with the stop(), suspend() and resume() methods in JDK 1.2? The stop(), suspend() and resume() methods have been deprecated in JDK 1.2. 9. How does Java handle integer overflows and underflows? It uses those low order bytes of the result that can fit into the size of the type allowed by the operation. 10. What state does a thread enter when it terminates its processing? When a thread terminates its processing, it enters the dead state. 11. What method is used to specify a container's layout? The setLayout() method is used to specify a container's layout. 12. What is the difference between the >> and >>> operators? The >> operator carries the sign bit when shifting right. The >>> zero-fills bits that have been shifted out. 13. Is a class a subclass of itself? A class is a subclass of itself. 14. Name the eight primitive Java types. The eight primitive types are byte, char, short, int, long, float, double, and boolean. 15. What modifiers may be used with an interface declaration? An interface may be declared as public or abstract.
|