permaculture playing cards
The moose likes Beginning Java and the fly likes Vector into Array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic

Vector into Array

J. Alenis

Joined: Jul 12, 2004
Posts: 16
I would like to know if it is possible and how to do the following. I get a created Vector and I need to put it into an Array. Here are pieces of my program:

String [] columnName ={"sqlcode","sqlmessage","predicaat"};
String [] columnIO ={"out","out","in"};
String [] columnType ={"integer","varchar","varchar"};
Object [] columnValue ={"","","'nn>''123456789010'''"};

Vector in = new Vector();
for (int i=0; i<columnName.length;++i)
{Vector row = new Vector();

And I want all the elements in an array that will look like this:

String[][]SP_parms = {{"Out","integer","sqlcode","0"},
{"Out","varchar","sqlmessage",""} };
Can somebody please help me.
Vijayendra V Rao
Ranch Hand

Joined: Jul 04, 2004
Posts: 195
An Array is nothing but a collection of similar "type" elements. So, since a Vector is an Object, you can have an array of Objects. I don't think you will need to have a multi-dimensional array, the way you have put it. Just a normal array can be used to hold Object-type elements.

Try it out. It should be possible.

Vijayendra <br /> <br />"The harder you train in peace, the lesser you bleed in war"
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
Round these parts, posting the same question in multiple forums is bad practice. It can make it rather difficult to follow a conversation, plus folks spend time saying things that were just said.

Please continue in the duplicate thread in the Intermediate forum.

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
I agree. Here's the link:
subject: Vector into Array
It's not a secret anymore!