Søren Gjesse | 96b3725 | 2021-08-09 16:08:05 +0200 | [diff] [blame] | 1 | // Copyright (c) 2021, the R8 project authors. Please see the AUTHORS file |
2 | // for details. All rights reserved. Use of this source code is governed by a | ||||
3 | // BSD-style license that can be found in the LICENSE file. | ||||
4 | |||||
5 | package pattern_matching_for_instanceof; | ||||
6 | |||||
7 | final class Main { | ||||
8 | public static void main(String[] args) { | ||||
9 | Object obj = "Hello, world!"; | ||||
10 | if (obj instanceof String s) { | ||||
11 | System.out.println(s); | ||||
12 | } | ||||
13 | } | ||||
14 | } |