These notes are a summary of the following Youtube Video.

Venkat Subramaniam is a very informative speaker. I first saw him speak at a Spring Conference I attended in 2010.

Switch Expression

The Switch Expression was improved in newer versions of Java

return switch(input) {
	case 1 -> "one";
	case 2 , 3 -> "two or three";
	case 4 -> {
		yield "four";
	default -> "whatever"

The Switch Statement introduces a yield command that allows you to return a value from a switch statement.

The case statement no longer requires a break statement when used as an expression that returns or yields values, as shown by the example above.

Text Blocks

Java introduced this very similar feature to those provided in other languages.

String text = """
Some Text Here
And Here       \\s
	And Here


Text Blocks can span multiple lines and are surrounded by three quotes

Java Text Blocks are clever in that they recognize when -

There is no need to escape characters in a Text Block

Text Blocks in Java are syntactic sugar for the compiler. The byte code reveals that these are compiled to a single String


A record is syntactic sugar used to implement objects and implements five methods that are hidden away.