Results 1 to 5 of 5

Thread: Vectors

  1. #1
    Zelaine is offline Senior Member
    Join Date
    Aug 2013
    Location
    Sweden
    Posts
    161
    Rep Power
    2

    Default Vectors

    Hello!
    I just wanted to ask if it is possible to create an array of strings, and also how to do it, where every cell contains a string. If you guys helped me out, that would be great :)

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,041
    Rep Power
    10

    Default Re: Vectors

    What have you tried? Where specifically are you stuck? Where is your SSCCE?
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Zelaine is offline Senior Member
    Join Date
    Aug 2013
    Location
    Sweden
    Posts
    161
    Rep Power
    2

    Default Re: Vectors

    I tried to replicate a program I did a long time ago in C++, where I used a vector of the type String. And I copied code over from that, and changed a few things after looking around a few explanations of vectors in Java on some forums. But I didn't find what I was looking for. So what I was trying to do is this, a vector, or array, that contains three elements where every element is a string. I know this code down below is totally wrong but it could give you an explanation of what I'm trying to do.

    Java Code:
    Vector name = new Vector{"Hejsan", "På", "Er", "Allihopa!"};

  4. #4
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,365
    Rep Power
    6

    Default Re: Vectors

    You said you wanted an array, so why then are you trying to create a vector?
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  5. #5
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,041
    Rep Power
    10

Similar Threads

  1. Need Help with Vectors
    By MadMikeUCF in forum New To Java
    Replies: 1
    Last Post: 04-13-2012, 01:07 AM
  2. Need Help Regarding Vectors
    By xHoly in forum New To Java
    Replies: 6
    Last Post: 05-23-2010, 07:56 AM
  3. Vectors Problem
    By dashwall in forum New To Java
    Replies: 9
    Last Post: 01-05-2010, 12:16 AM
  4. Vectors of Vectors or hash-somethings?
    By mindwarp in forum New To Java
    Replies: 3
    Last Post: 03-10-2008, 03:57 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •