Académique Documents
Professionnel Documents
Culture Documents
Aspectos teóricos:
Ejemplo
import java.util;
public class Uso_tallas{
enum Talla{
private String abreviatura;
private Talla(String abreviatura){
this.abreviatura=abreviatura;
}
public String dameAbreviatura(){
return abreviatura;//////este geter debe estar en public
}
MINI(“S”), MEDIANO(“M”),GRANDE(“L”), MUY_GRANDE(“XL”);
}
public static void main(String[] args){
}
Veamos otro ejemplo:
ENUM PARA DEMARCACION
package Main;
public Futbolista() {
}
................................
@Override
public String toString() {
return this.dorsal + " - " + this.Nombre + " - " + this.demarcacion.name() + " - "
+ this.equipo.getNombreClub();///El programa solo ejecuta esto
}
}
El resultado es:
1 - Casillas - PORTERO - Real Madrid
11 - Capdevila - DEFENSA - Villareal
6 - Iniesta - CENTROCAMPISTA - FC Barcelona
22 - Navas - DELANTERO - Sevilla FC