Forums Register Login

unnecessary cast?

+Pie Number of slices to send: Send
In line 2, why is there a cast on method rs.getMetaData() when the return type is already a ResultSetMetaData type?
The code ran fine when I removed the cast, so I'm wondering if there is an 'advanced' reason for the cast.

+Pie Number of slices to send: Send
Hi Tim,

I think the cast is not necessary.

Where did you get this code from? Is the author using a specific jdk version?
+Pie Number of slices to send: Send
 

Tim Nachreiner wrote:The code ran fine when I removed the cast, so I'm wondering if there is an 'advanced' reason for the cast...


Nope. Indeed, the docs for the class specifically show an example without one.

Winston
+Pie Number of slices to send: Send
 

Balagopal Kannampallil wrote:

Where did you get this code from? Is the author using a specific jdk version?



Most of my sample code for JTable comes from Oracle's jdk6 site. I'm not 100% sure that's where this came from.
+Pie Number of slices to send: Send
No worries!!
I was curious to know where this piece of code came from.
It wasn't my idea to go to some crazy nightclub in the middle of nowhere. I just wanted to stay home and cuddle with this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 650 times.
Similar Threads
How to call non-static method seticon
ResultSet to TableModel (using ArrayLists)
Rendering JCheckBox into JTable with MariaDB
No column names in JTable
updating jTable's display
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 03:13:35.