Clément Béra | b1253f0 | 2021-02-03 10:21:33 +0000 | [diff] [blame] | 1 | // Copyright (c) 2020, 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 records; |
| 6 | |
| 7 | public class RecordInstanceOf { |
| 8 | |
| 9 | record Empty() {} |
| 10 | |
| 11 | record Person(String name, int age) {} |
| 12 | |
| 13 | public static void main(String[] args) { |
| 14 | Empty empty = new Empty(); |
| 15 | Person janeDoe = new Person("Jane Doe", 42); |
| 16 | Object o = new Object(); |
| 17 | System.out.println(janeDoe instanceof java.lang.Record); |
| 18 | System.out.println(empty instanceof java.lang.Record); |
| 19 | System.out.println(o instanceof java.lang.Record); |
| 20 | } |
| 21 | } |