#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    8
    Rep Power
    0

    Vectors and the Vector Class


    Hey everybody!
    I'm new to the forum and generally new to programming, but I've been taking this course on programming in Java at my college in Germany and I have a problem to which I have yet been unable to find a viable answer:

    For the past week I've been struggling with the concept of vectors and the Cector class. If anybody could give me the cliff notes on what a vector is and where/how it is used I'd be much obliged.

    Thanks a lot in advance.

    Dän

    P.S. Let me know if I've made any mistakes in posting my request the way I did.
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Location
    Saint-Petersburg, Russia
    Posts
    236
    Rep Power
    28
    Do you know what array is?

    I mean the storage of elements to which you can have access by indexing the array.

    Shortly speaking Vector is just the same.

    Though java has plain arrays, they are not always handy. Sometimes we want collections of elements of other types (lists, sets etc.).

    That is when interface "Collection" was introduced with several classes implementing this interface. Since plain array could not implement this interface, a kind of wrapper class was designed and named Vector.

    Nowadays Vector is not widely used since there are better designed classes with similar properties, for example ArrayList. It is bit strange that class Vector is used in your course. Though it will not do much harm.
    CodeAbbey - programming problems for novice coders
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    8
    Rep Power
    0
    Yes, that actually helped a lot. Thank you very much.

IMN logo majestic logo threadwatch logo seochat tools logo