<java>EnumSet

Fermé
domxaline Messages postés 188 Date d'inscription lundi 16 mai 2005 Statut Membre Dernière intervention 7 mars 2018 - 3 juin 2010 à 14:05
domxaline Messages postés 188 Date d'inscription lundi 16 mai 2005 Statut Membre Dernière intervention 7 mars 2018 - 3 juin 2010 à 14:23
Bonjour,
public enum Tuna
{
    bucky("nice", "22"),
    kelsy("cutie", "10"),
    julia("bigmistake", "12"),
    nicole("italien","13"),
    candy("different","14"),
    erin("wish","16");

    private final String desc;
    private final String year;
    Tuna(String description,String birthday)
    {
        desc=description;
        year=birthday;
    }
    public String getDesc()
    {
        return desc;
    }
    public String getYear()
    {
        return year;
    }
}
package javaapplication1;
import java.util.EnumSet;
public class Apples
{
 public static void main(String[]args)
   {
       for(Tuna people:Tuna.values())
          System.out.printf("%s\t%s\t%s\n",people,people.getDesc(),people.getYear());
          System.out.printf("\nAnd now for the range of constante!!\n");

       for(Tuna people:EnumSet.range(Tuna.kelsey,Tuna.candy))
          System.out.printf("%s\t%s\t%s\n",people,people.getDesc(),people.getYear());
   }
)

Tuna.candy est souligné dans la ligne
for(Tuna people:EnumSet.range(Tuna.kelsey,Tuna.candy))

et indique "can not find symbol symbol:variable kelsey location:class javapplication1.Tuna

en compilant j'ai erreur suivante
bucky nice 22
kelsy cutie 10
julia bigmistake 12
nicole italien 13
candy different 14
erin wish 16

And now for the range of constante!!
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code
at javaapplication1.Apples.main(Apples.java:12)

aidez moi s'il vous plaît




A voir également:

1 réponse

domxaline Messages postés 188 Date d'inscription lundi 16 mai 2005 Statut Membre Dernière intervention 7 mars 2018 10
3 juin 2010 à 14:23
merci , j'ai corrigé mon erreur
0