Why the code below not showing any output... Anyone can help me plz... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Why the code below not showing any output... Anyone can help me plz...

enum color { RED, BLUE, GREEN; } class PrintColor { public static void main(String[] args) { Color color = Color.RED; switch (color) { case BLUE : System.out.println ("1"); break; case GREEN : System.out.println ("2"); break; default: System.out.println ("0"); break; } } }

26th Jun 2019, 1:30 PM
Boy Arya
Boy Arya - avatar
10 Answers
+ 2
0
6th Dec 2020, 7:04 AM
Dhika Nur Aisyah
+ 1
Thnks all for the help
26th Jun 2019, 3:49 PM
Boy Arya
Boy Arya - avatar
0
In first line, write color with capital C
26th Jun 2019, 1:45 PM
Shamima Yasmin
Shamima Yasmin - avatar
0
Try this - enum Color { RED, BLUE, GREEN; } public class PrintColor { public static void main(String[] args) { Color color = Color.RED; switch (color) { case BLUE : System.out.println ("1"); break; case GREEN : System.out.println ("2"); break; default: System.out.println ("0"); break; } } }
26th Jun 2019, 1:53 PM
Rounak Muchhal
Rounak Muchhal - avatar
0
Answer = 0
23rd Mar 2021, 4:56 PM
Tejashree Suryawanshi
Tejashree Suryawanshi - avatar
0
0
12th Sep 2021, 3:51 AM
Sujit Nanasaheb Dudhe.
0
0
15th Nov 2021, 6:05 AM
Nabila Muftia Ma'ruf Kartono
Nabila Muftia Ma'ruf Kartono - avatar
0
0
1st Jan 2022, 8:33 AM
M.I.M.Aqueel
M.I.M.Aqueel - avatar
0
o is the aswer using
30th Apr 2022, 9:15 AM
MAREESWARAN S
MAREESWARAN S - avatar
0
import java.util.Scanner; public class color { public static void main(String[] args) { String color=""; Scanner in = new Scanner(System.in); color=in.next(); switch(color) { case "red": System.out.println(1); break; case "green": System.out.println(2); break; case "black": System.out.println(3); break; default : System.out.println("Nothing"); break; } } }
2nd Jan 2024, 5:34 PM
Anjali R Gurav
Anjali R Gurav - avatar