en
en

Question du test Java - Les bases

Afficher la valeur de l'enum Color.BLUE

Intermédiaire

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 643 fois
Modifier
1
É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
Clément Devos (W3D Team)
19/02/2022
Thanks Florian, we'll fix this typo ASAP
developer avatar
Vincent Cotro
21/02/2022
Fixed ! Thank you Florian.