Taller 12 introduces interfaces — the Java mechanism for defining pure behavior contracts that any class can fulfill, regardless of its class hierarchy. Unlike abstract classes, interfaces carry no instance state and no implementation (in standard Java 8+ form); they only declare method signatures. Crucially, a single class can implement as many interfaces as needed, letting you mix unrelated capabilities onto one object in a way that single-inheritance class trees never allow.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Jhaymayleth/unidad2_java/llms.txt
Use this file to discover all available pages before exploring further.
Exercises
Ejercicio 1: Ave & Interfaces
Define
Volador and Cantante interfaces, then build an Ave class that satisfies both contracts at once.Ejercicio 2: Pez & Nadador
Define
Nadador and Respirador interfaces, then implement both on a Pez class to model aquatic behavior.Ejercicio 3: Pajaro & Piedra
Explore selective interface adoption —
Pajaro takes Cantante, Piedra takes Volador, each in the Ejercicio3 sub-package.Key Concepts
| Concept | Summary |
|---|---|
interface | Declares a set of method signatures with no implementation. All methods are implicitly public abstract. |
implements | Keyword used by a class to commit to fulfilling one or more interfaces. |
| Multiple interface implementation | A class can list several interfaces separated by commas: implements A, B, C. |
| Interface vs abstract class | An abstract class can carry state and partial implementation; an interface is a pure contract. A class can extend only one class but implement many interfaces. |
Interface Syntax Reference
Declaring an interface requires only the method signature — no body, no access modifier needed on the method (it is implicitlypublic abstract):
implements, separated by commas. It must provide a concrete @Override for every method declared in each interface:
Compile Commands
All top-level Taller 12 classes belong to theTaller12 package. Compile from the project root (the directory that contains the Taller12/ folder):