equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
26 package java.lang; |
26 package java.lang; |
27 |
27 |
28 /** |
28 /** |
29 * Thrown to indicate that the code has attempted to cast an object |
29 * Thrown to indicate that the code has attempted to cast an object |
30 * to a subclass of which it is not an instance. For example, the |
30 * to a subclass of which it is not an instance. For example, the |
31 * following code generates a <code>ClassCastException</code>: |
31 * following code generates a {@code ClassCastException}: |
32 * <blockquote><pre> |
32 * <blockquote><pre> |
33 * Object x = new Integer(0); |
33 * Object x = new Integer(0); |
34 * System.out.println((String)x); |
34 * System.out.println((String)x); |
35 * </pre></blockquote> |
35 * </pre></blockquote> |
36 * |
36 * |
37 * @author unascribed |
37 * @author unascribed |
38 * @since 1.0 |
38 * @since 1.0 |
39 */ |
39 */ |
40 public |
40 public |
41 class ClassCastException extends RuntimeException { |
41 class ClassCastException extends RuntimeException { |
|
42 @java.io.Serial |
42 private static final long serialVersionUID = -9223365651070458532L; |
43 private static final long serialVersionUID = -9223365651070458532L; |
43 |
44 |
44 /** |
45 /** |
45 * Constructs a <code>ClassCastException</code> with no detail message. |
46 * Constructs a {@code ClassCastException} with no detail message. |
46 */ |
47 */ |
47 public ClassCastException() { |
48 public ClassCastException() { |
48 super(); |
49 super(); |
49 } |
50 } |
50 |
51 |
51 /** |
52 /** |
52 * Constructs a <code>ClassCastException</code> with the specified |
53 * Constructs a {@code ClassCastException} with the specified |
53 * detail message. |
54 * detail message. |
54 * |
55 * |
55 * @param s the detail message. |
56 * @param s the detail message. |
56 */ |
57 */ |
57 public ClassCastException(String s) { |
58 public ClassCastException(String s) { |