Question du test Java - Les bases

Afficher la valeur de l'enum Color.BLUE

Difficile

Code :

enum Couleur{
    BLEU(0), ROUGE(1), VERT(2);

    int value;

    Couleur(int value){
        this.value = value;
    }
}
public class QuestionJava {
	public static void main(String[] args) {
    		System.out.println(Couleur.BLEU);
	}
}

Que renvoie ce code ?

Auteur: PierreStatut : PubliéeQuestion passée 459 fois
Modifier
0
Évaluations de la communautĂ©
developer avatar
Florian
19/02/2022
There's a spelling error here in the code. The author, obviously French, wrote "Colors.BLEU" instead of "Colors.BLUE". It can lead you to think you should answer "a mistake" whereas it's not the author's intention
developer avatar
Auteur anonyme
19/02/2022
Thanks Florian, we'll fix this typo ASAP
developer avatar
Auteur anonyme
21/02/2022
Fixed ! Thank you Florian.