Answers for "string matching in java"

0

Java pattern matching

static void testTriangle(Shape s) {
    switch (s) {
        case Triangle t && (t.calculateArea() > 100) ->
            System.out.println("Large triangle");
        case Triangle t ->
            System.out.println("Small triangle");
        default ->
            System.out.println("Non-triangle");
    }
}
Posted by: Guest on September-14-2021

Code answers related to "string matching in java"

Browse Popular Code Answers by Language