New grammar for Java 12 Switch statements

String time = switch (weekday) {
  case MONDAY, FRIDAY -> "10:00-18:00";
  case TUESDAY, THURSDAY -> "10:00-14:00";
  default -> "holiday";
};

You can write like this

Recommended Posts

New grammar for Java 12 Switch statements
Java if and switch statements
[Java] Summary of for statements
Java while and for statements
For JAVA learning (2018-03-16-01)
Java basic grammar
Java basic grammar
2017 IDE for Java
java1.8 new features
Java basic grammar
Java basic grammar
Java for statement
Java switch statement
Let's use Java New FileIO! (Introduction, for beginners)
[Java] for statement, while statement
Java 12 new feature summary
[Java] Package for management
Java 13 new feature summary
[Java] for statement / extended for statement
Countermeasures for Java OutOfMemoryError
Switch java with direnv
NLP for Java (NLP4J) (2)
(Memo) Java for statement
NLP for Java (NLP4J) (1)
What's new in Java 8
Java 10 new feature summary
Java 14 new feature summary
What's new in Java 9,10,11
Java conditional branching: How to create and study switch statements
[Java Silver] Things to be aware of regarding switch statements
Java review ③ (control syntax [if / switch / while / for], conditional expression)
[Java] New Thread generation method (2)
Java update for Scala users
Java debug execution [for Java beginners]
[Java] Basic statement for beginners
New features from Java7 to Java8
[Java] Precautions for type conversion
About Java variable declaration statements
Books used for learning Java
2018 Java Proficiency Test for Newcomers-Basics-
Java thread safe for you
Java for beginners, data hiding
[Java] Tips for writing source
Java installation location for mac
Seasonal display with Java switch
Java application for beginners: stream
[Java] New Thread generation method (1)
Utilization of Java array elements, for, length, value, and extended for statements