aspose file tools*
The moose likes Java in General and the fly likes Vectors within vectors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Vectors within vectors" Watch "Vectors within vectors" New topic
Author

Vectors within vectors

Yun Lee
Greenhorn

Joined: Mar 11, 2010
Posts: 6
Hi,

I've made a vectors within vectors, and now trying to initialise it, I just can't get it to work.

The problem is in lines 64 ~ 67, PLEASE help me out!!


thanks.



PLEASE HELP!!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60041
    
  65

Please UseCodeTags.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Yun Lee
Greenhorn

Joined: Mar 11, 2010
Posts: 6
Bear Bibeault wrote:Please UseCodeTags.


Edited. Please help!!
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39535
    
  27
Yun Lee wrote:Edited.

Do you really not indent your code? Do you think it's easy to read as it is?


Ping & DNS - updated with new look and Ping home screen widget
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18110
    
    8

You said you had a problem with that code; would you like to explain what it is? Even for somebody who wants to try reading that code, there isn't much point without having some idea of what to look for.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Please don't post the same question more than once. I am locking your previous post.
Yun Lee
Greenhorn

Joined: Mar 11, 2010
Posts: 6
Paul Clapham wrote:You said you had a problem with that code; would you like to explain what it is? Even for somebody who wants to try reading that code, there isn't much point without having some idea of what to look for.


yeah the problem is in the last section;



Basically I am trying to bring/initialise the values from the vectors within the vectors... so in each slot of the teamVector is another vector, so I am trying to bring those out, but it won't work...

String teamVector.get(1) works and gets the values of the whole vector, but when I ask for a specific slot in the vector (inside the main vector), it won't work. Maybe I should write something other than StringteamVector.get(1).get(1) ?


And the mods: I've just joined today, and the only rule was 'be nice'. Someone already told me not to post twice and that was enough. Not every single 'sheriff' needs to come and repeat what other sheriffs say. Thank you.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Sorry, I didn't read through both of your other identical posts. That aside, there's nothing "not nice" about telling you the rules, and enforcing them.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18110
    
    8

When you say "won't work", can you be more specific?

I mean, to me it looks like that code fragment won't even compile. So I don't see how you could run it to see what it does. But anyway, it would be helpful for you to explain your problem. If you have error messages, then tell us what they are. Tell us whether they are compiler errors or runtime errors. Post stack traces if you get them. And so on.
Matt Cartwright
Ranch Hand

Joined: Aug 25, 2008
Posts: 149

this dog won't hunt

  • the clone() method defined on java.lang.Object returns an object of type Object. This cannot be assigned to an object of type Vector. Why do you need to clone?


  • When instantiating the Defender object, you are using "int" which in this context is a syntax error. Remove them.


  • Let's assume your defender definition is something like:


    To make all the warnings (type safety) go away, your method signatures need changing to:

    Its gotta match the your teamVector definition.


    So if you then change it to:


    the dog starts running

     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Vectors within vectors
     
    Similar Threads
    when static initialization occurs
    <identifier> expected problem - Vectors.
    Vectors within vectors
    command line arguments for a file
    Regarding reading a file in a jsp