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

Pages: 1-

Java question

Name: Anonymous 2014-03-07 23:42

How would I turn this into one array of size 9?

for (int i=0; i <3; i++) {
    for (int j=0; j<3; j++) {
        System.out.print(array[i][j]);
}
}



Would this work?

public static void region (int[][] array){
k=0;
for (int i=0; i <3; i++) {
    for (int j=0; j<3; j++) {
        System.out.print(array[i][j]);
         newArray[k]=array[i][j];
         k++;
}
}
}

Name: Anonymous 2014-03-07 23:59

Java does not have arrays you stupid fuck, it's a managed language. Do you even know what that means? It means that the OS manages memory so M$ didn't put them in. Use a fucking list and be done with it.

Name: Anonymous 2014-03-08 0:03

Hey man I am just learning Java and trying to figure somethings out from some assignments I got. No need to get all upset.

Name: Anonymous 2014-03-08 0:06

Read HtDP. http://htdp.org/

Name: Anonymous 2014-03-08 0:27

Use the Java Native Interface to send your array to a real language that can allow pointer level manipulation.

Name: Anonymous 2014-03-08 2:06

Since I'm going to assume the assignment is strictly for Java, resorting to another language is out of the question ... unless your professor doesn't give two shits and you actually really, for some God-awful reason, want to learn Java.

Regardless, yes what you have will work. Probably not the best approach; however, it will work.

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