• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Hashtable casting error

 
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all
I am having a problem while using Hashtable.
Below is the piece of code.
I am basically retrieving a list from the query.
trying to store it in temporary list for which i am using Hashtable as the
VO.

I guess the error is in the System.out.println.But dont how to solve
 
author
Posts: 23958
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
tempLaneList hold hashtable arrays. You can't cast a hashtable array into a hashtable.

Henry
 
meena latha
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Henry....
I will be great if you can tell me how to do that.
Basically i am getting ClassCastException.
Thanks
 
Henry Wong
author
Posts: 23958
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by meena latha:
Thanks Henry....
I will be great if you can tell me how to do that.
Basically i am getting ClassCastException.
Thanks



Meena,

You can't cast a hashtable array into a hashtable. There is no "how to do that", you can't cast something into something else that it is not.

You have two choices to fix this -- and it depends on what you are trying to do. You can add() a hashtable instead of the hashtable array, at the line previously. Or you can cast it to a hashtable array, and dereference it to the hashtable that you want.

Henry
 
meena latha
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks it is working.
I replaced Hashtable array with Hashtable.
 
What do you have to say for yourself? Hmmm? Anything? And you call yourself a tiny ad.
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic