This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Java in General and the fly likes ClassCastException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "ClassCastException" Watch "ClassCastException" New topic
Author

ClassCastException

Adamu Yifru
Greenhorn

Joined: May 22, 2003
Posts: 6
Why does the following code give me classCastException error
some LinkedList
Integer.parseInt(nonRTarrivalTime.getFirst())
and
((Integer)nonRTarrivalTime.getFirst()).intValue()
I have tried both and they give me the same error.
thanks in advance.
Adamu Yifru
Greenhorn

Joined: May 22, 2003
Posts: 6
Never mind I casted it to a string and then to int.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: ClassCastException