• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

somebody help me out

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why is this code:-

Vector v = new Vector();
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("SELECT acc_id FROM mytable");

while(rs.next()) {
v.addElement(rs.getString("acc_id"));
}
rs.close();

giving me this warning:-
warning: [unchecked] unchecked call to add(E) as a member of the raw type java.util.Vector
v.addElement(rs.getString("acc_id"));

please can someone explain to me why and what to do next

joe
 
Ranch Hand
Posts: 457
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
please read this and edit your post
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Basically you have three choices:
  • Ignore the warning
  • Suppress it with the SuppressWarnings annotation
  • Let the compiler know about the type of object your collection stores. See the Generics tutorial to find out more.


  • One more thing, why are you using a Vector?
    [ December 14, 2007: Message edited by: Paul Sturrock ]
     
    reply
      Bookmark Topic Watch Topic
    • New Topic