• Post Reply Bookmark Topic Watch Topic
  • New Topic

somebody help me out  RSS feed

 
joseph okon
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • 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
 
Bill Shirley
Ranch Hand
Posts: 457
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please read this and edit your post
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • 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 ]
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!