1. /*
  2. * @(#)ClassCastException.java 1.20 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.lang;
  8. /**
  9. * Thrown to indicate that the code has attempted to cast an object
  10. * to a subclass of which it is not an instance. For example, the
  11. * following code generates a <code>ClassCastException</code>:
  12. * <p><blockquote><pre>
  13. * Object x = new Integer(0);
  14. * System.out.println((String)x);
  15. * </pre></blockquote>
  16. *
  17. * @author unascribed
  18. * @version 1.20, 12/19/03
  19. * @since JDK1.0
  20. */
  21. public
  22. class ClassCastException extends RuntimeException {
  23. /**
  24. * Constructs a <code>ClassCastException</code> with no detail message.
  25. */
  26. public ClassCastException() {
  27. super();
  28. }
  29. /**
  30. * Constructs a <code>ClassCastException</code> with the specified
  31. * detail message.
  32. *
  33. * @param s the detail message.
  34. */
  35. public ClassCastException(String s) {
  36. super(s);
  37. }
  38. }