0

How to use string in switch in java?

Please answer my question, I am new to programming.

5th Apr 2019, 10:32 AM
जय भारत
जय भारत - avatar
5 odpowiedzi
+ 4
You can see my example code. Hope it helps you. https://code.sololearn.com/cJxcwS9gIAS5/?ref=app
5th Apr 2019, 10:47 AM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 6
zemiak, true Now in Java 12 this is possible switch (day) { case MONDAY, FRIDAY, SUNDAY -> System.out.println(6); case TUESDAY -> System.out.println(7); case THURSDAY, SATURDAY -> System.out.println(8); case WEDNESDAY -> System.out.println(9); } https://hackernoon.com/announcement-java12-has-released-435e659affee https://dzone.com/articles/jdk-12-switch-statementsexpressions-in-action
5th Apr 2019, 12:33 PM
voja
voja - avatar
+ 2
Thank you so much
5th Apr 2019, 10:50 AM
जय भारत
जय भारत - avatar
+ 2
+ there are new advanced features in Java 12 for switch (Sololearn uses java 10)
5th Apr 2019, 11:41 AM
zemiak
+ 1
जय भारत, you are welcome 😉
5th Apr 2019, 2:54 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar