Source Home >> Java Source 1.6.0 >> java.lang.ClassCastException V 0.09
  • 01/*
  • 02 * @(#)ClassCastException.java 1.21 05/11/17
  • 03 *
  • 04 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
  • 05 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  • 06 */
  • 07
  • 08package java.lang;
  • 09
  • 10/**
  • 11 * Thrown to indicate that the code has attempted to cast an object
  • 12 * to a subclass of which it is not an instance. For example, the
  • 13 * following code generates a <code>ClassCastException</code>:
  • 14 * <p><blockquote><pre>
  • 15 * Object x = new Integer(0);
  • 16 * System.out.println((String)x);
  • 17 * </pre></blockquote>
  • 18 *
  • 19 * @author unascribed
  • 20 * @version 1.21, 11/17/05
  • 21 * @since JDK1.0
  • 22 */
  • 23public
  • 24class ClassCastException extends RuntimeException {
  • 25 /**
  • 26 * Constructs a <code>ClassCastException</code> with no detail message.
  • 27 */
  • 28 public ClassCastException() {
  • 29 super();
  • 30 }
  • 31
  • 32 /**
  • 33 * Constructs a <code>ClassCastException</code> with the specified
  • 34 * detail message.
  • 35 *
  • 36 * @param s the detail message.
  • 37 */
  • 38 public ClassCastException(String s) {
  • 39 super(s);
  • 40 }
  • 41}

文件:ClassCastException.java
包名:java.lang
类名:ClassCastException
继承:RuntimeException
接口: