• Post Reply Bookmark Topic Watch Topic
  • New Topic

Vector constructor  RSS feed

 
samdeep aarzoo
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


on compilation i m getting error
can anybody help
 
samdeep aarzoo
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
SORRY, i got the answer
I have not used import java.util.*;
 
Stuart Gray
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can help you I think - but you could also help us by providing the exact error message you are getting!

I imagine the problem is that the compiler cannot find the Vector class. Try adding this line to the very top of your code:

Also note that Vector might not be the best class to use; you might prefer one of the more modern Collection classes such as ArrayList instead. But try that for now and see if it works!
 
Stuart Gray
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah, you posted just before I replied. Also note that many people consider it better to specifically import java.util.Vector than to put a general import statement such as import java.util.*. This is because you may find two classes with the same name in two different packages, and because it can make it hard to determine at a glance which classes your code uses.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For future referece, you need to post the error message that we are getting. It will save you a lot of time since we can only guess at the problem otherwise.

Layne
 
Saurabh Dixit
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One of the best things about java errors is that the error message is self explanatory, and helps in solving the error. So do read the error message carefully while debugging.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!