Skip to content

Instantly share code, notes, and snippets.

Last active November 26, 2021 14:30
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Przykłady kodu do wpisu o nowych możliwościach Javy 17 znajdującego się pod adresem:
switch(i) {
case null -> System.out.println("It's a null!");
case Integer s && s < 10 -> System.out.println("It's a number smaller than 10");
case String s && s.length() < 20 -> System.out.println("Short string");
case String s -> System.out.println("Long String");
default -> System.out.println("It's something else");
package pl.mloza;
public sealed class Shape
permits Circle, Square, Rectangle {
final class Circle extends Shape {}
non-sealed class Square extends Shape {}
final class Rectangle extends Shape {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment