 In this video, we're going to see how to get started with Java 17 in Visual Studio Code. So in this environment, I got only two extensions, the language support for Java by Red Hat and the debugger for Java by Microsoft. So first, I'm in an empty folder and I'm going to create a hello.java file. Once the file is created, you'll see the language server is starting. And then once it's started, I can start typing the content with a class snippet and then a domain snippet. And then I can go on with system out. I'm going to create a statement hello from Java with the Java version. So system.getProperty.java.version. And then I will just have to save the file and run it. Then we'll compile and execute the class and I'll say hello from Java 11, which is the Java version used to run my extension. So the first thing I want to do is make it faster. So there's a couple of settings to enable to run the code in the debug console. Once that is set, you'll see that it runs much faster. It still says Java 11, so we're going to fix that next. So back to the settings, I'm going to create a new configuration environment. So Java.configuration.runTimes, I'm going to create a new Java 17 entry. So name Java 17, I will then set the path to my JDK. So I'm currently using SDKman to manage my different JDK environments. So in this case, I will use the Java 17 runtime from the Temuring project. And don't forget to set this runtime as the default Java runtime. So back to my hello class, I can run it again and then it now runs with Java 17. So now I can actually show you actual Java 17 features. The first one is the sealed classes. So I'm going to create a shape.java interface and I'm going to add the sealed keyword. So sealed classes allow me to restrict the number of implementations of a given interface or a class. So I'm going to permit a rectangle for my shape and a circle. So obviously the classes don't exist, so I'm going to use quick fixes to create the rectangle first and the circle, save the file and go to the rectangle to add a couple of things. So as you can see, it's a final class, it cannot be extended. So I'm going to add a width and a length fields for my rectangle and generate constructors out of those attributes. And I will also create a two string implementation. And then I'll do basically the same thing for the circle with radius, a public double radius, create a constructor as well, and then create a two string method. All right, so now I have all my classes that extend the interface shape and I want to compute their area. So I'm going to create a rectangle instance first with the width of one, length of two, and I'm going to implement the missing method area. It's not going to be a rectangle, but a shape, and then I will rename it to shape as well. Now in order to implement my area method, I'm going to use another Java 17 feature called pattern matching and suits expressions. Also, it's still a preview feature in Java 17. So normally you would have to manually set the dash-enabled preview flag in your maybe no gradle build. But here we simply open a folder without any build tool. So we have a non-managed project, so to speak. Fortunately, in such cases, if you're compelling against the latest Java version, VSCO Java will automatically enable preview features for you. So now I'm going to create a local variable var area that will receive the result of a switch expression. So I'm going to switch over the shape and I will switch to a case of rectangle. And the area of the rectangle is the rectangle length multiplied by its width. And as you can see, a switch expression should have a default case to cover all cases. But I'm using sealed classes. So if I add a case circle, which area will be math.py multiplied by the radius squared. So now I've covered all cases, so I no longer have an error so I can display the area of my shape. So shape plus area equals area. And I just have to now run the code. And in the debug console, my rectangle has an area of 2. I do the same thing for a circle of radius 2. Run it and get an area of 12.5. But what happens for a null value? So if I run it, as you would expect, you will see a null pointer exception. Fortunately, the new pattern matching supports null cases now. So in that case of null, I will just return the value zero. When I save the file, run it. I no longer get the null pointer exception, get null area equals zero. And everything is fine. So that's it for today. A quick introduction to Java 17 in VSCO Java. Thanks for watching.