Questions
- What methods would a class that implements the
java.lang.CharSequenceinterface have to implement?
- What is wrong with the following interface?
public interface SomethingIsWrong { void aMethod(int aValue){ System.out.println("Hi Mom"); } }
- Fix the interface in question 2.
- Is the following interface valid?
public interface Marker { }Exercises
- Write a class that implements the
CharSequenceinterface found in thejava.langpackage. Select one of the sentences from this book to use as the data. Write a smallmainmethod to test your class; make sure to call all four methods.
- Suppose you have written a time server that periodically notifies its clients of the current date and time. Write an interface the server could use to enforce a particular protocol on its clients.
ATENCIÓN: La traducción de esta documentación es un esfuerzo personal y voluntario. NO es un documento oficial del propietario de la tecnología Java, Oracle, ni está patrocinado por esta empresa.
Los documentos originales y actualizados (en inglés) están disponibles en: http://docs.oracle.com/javase/tutorial/. La versión disponible en este sitio es la publicada en Marzo de 2008 (más información en: "What's new and What's Old? The History of the Tutorial").
Dirige cualquier comentario, petición, felicitación, etc. a tutorialesjava@codexion.com.
Si quieres ayudar a mantener en funcionamiento esta web, colaborar con la traducción de estos documentos o necesitas que se traduzca algún capítulo en concreto puedes invitarme a un café: