Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Java help needed, arrays

Name: Anonymous 2012-01-25 14:23

So I faced a problem with java, I don't have an idea how to make a 2d array hold several 1d arrays in it's rows, can't find it on google. Tried smth like this, doesn't work
String data2[][]={};
String data[]={"lol", "lol2"};
int n=2;
        for(int i=0;i<n;i++){
            data2[i][2]=data;
        }

Any help guys?

Name: Anonymous 2012-01-25 14:29

Oh well, no help received, but i managed :). Primitive, but works.

        for(int i=0;i<n;i++){
            //i rows k columns
            data2[i][1]=data[1];
            data2[i][2]=data[2];
        }

Name: Anonymous 2012-01-25 14:53

I'M KOREAN
SON OF A BITCH AMERICAN
AMERICAN IS PIG
DO YOU WANT A HAMBURGER?
DO YOU WANT A PIZZA?
AMERICAN IS PIG DISGUSTING
NIGGER BAMA IS A MURDERER
FUCKING U.S.A
BRING BACK MEGAUP[LOAD FUCKERS

Name: Anonymous 2012-04-16 10:54

OP I have no idea what the fuck you're going for but you can try this.


int n = 2;
String[][] asd = new String[n][n];
String[] dsa = {"lol", "lol2"};
       
for (int i = 0; i < n; i++){
    asd[i] = dsa;
}

Don't change these.
Name: Email:
Entire Thread Thread List