|
|
Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |
Questions
1. What methods would a class that implements thejava.util.Iteratorinterface have to implement?2. What is wrong with the following interface?
public interface SomethingIsWrong { public void aMethod(int aValue){ System.out.println("Hi Mom"); } }3. Fix the interface in question 2.
4. Is the following interface valid?
public interface Marker { }Exercises
1. Write a class that implements theIteratorinterface found in thejava.utilpackage. The ordered data for this exercise is the 13 cards in a suit from a deck of cards. The first call tonextreturns2, the subsequent call returns the next highest card,3, and so on, up toAce. Write a smallmainmethod to test your class.2. Suppose that you have written a time server, which periodically notifies its clients of the current date and time. Write an interface that the server could use to enforce a particular protocol on its clients.
|
|
Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |
Copyright 1995-2004 Sun Microsystems, Inc. All rights reserved.