Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / January 2006

Tip: Looking for answers? Try searching our database.

ClassCastException

Thread view: 
hon123456 - 17 Jan 2006 04:23 GMT
Dear all,
         I am trying to learn Java. I found the explanation of
ClassCastException in Sun website as follows. But it seems rather
simple. I don't understand " cast an object to a subclass of which it
is not an instance" in the explanation. Please help me. By the way,
please suggest any good website that explains the ClassCastException in
detail.

>From sun:

Thrown to indicate that the code has attempted to cast an object to a
subclass of which it is not an instance. For example, the following
code generates a ClassCastException:

    Object x = new Integer(0);
    System.out.println((String)x);

Thanks.
Roedy Green - 17 Jan 2006 05:39 GMT
> ClassCastException:

see
http://mindprod.com/jgloss/runerrormessages.html#CLASSCASTEXCEPTION
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Mike Lewis - 17 Jan 2006 05:43 GMT
I think this site does a pretty good job of explaining:
http://www-csfy.cs.ualberta.ca/~c114/F05/Tutorials/Debugger/Cast/

Mike Lewis
Grinnell College
hon123456 - 17 Jan 2006 07:07 GMT
Thanks for you all. It helps a lot.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.