Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

howto: print records from Hashtable?

 
achana chan
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.
This probably sounds like a silly question because it is one, but I don't know how to do it.
Here is the code which inserts records into a Hashtable

And here is the client applet code snippet which calls the insertTXRecord() public method to insert a records and then calls the getTXRecord() to try and print it (for testing only);

At the moment, Java console is giving me this output:

system datetime stamp: Mar 3, 2004 3:00:03 PM
TXRecord: java.util.Hashtable$Enumerator@1531164

which is not what I want and doesn't make much sense to me.
TIA :-)
 
jeroen riezebeek
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Returns Enumeration wich is a collection of the elements in the tbl_TXRecords.
To print these element.
 
achana chan
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. Thanks for taking time to look at my issue and for the code.

However Java console throws this runtime error:

system datetime stamp: Mar 3, 2004 6:34:58 PM
TXRecord size: 1
getApplet exception: null
java.lang.ClassCastException at ConfirmationFrame$prdDtlActionListener.actionPerformed(ConfirmationFrame.java:341)

It's complaining about casting enum.nextElement() as a Hashtable ?
TIA :-)
 
achana chan
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But then, my technique doesn't work either

Throws compile time error

cannot resolve symbol
method get(java.lang.Object)
class TXRecord
.........System.out.println(obj + ": " + (Hashtable)txrecord.get(obj));

Same old nemesis, canna resolve symbol... :-(
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic