Hi, I'm using SJava (0.65) to interface some Java code I have and am having trouble understanding the use of arrays. I have a function: tmv <- function(fname) { a <- .JavaArrayConstructor("int", dim=c(3,0)) .JavaSetArrayElement(a, .JavaArrayConstructor("int", dim=3), 1) .JavaSetArrayElement(a, .JavaArrayConstructor("int", dim=3), 2) .JavaSetArrayElement(a, .JavaArrayConstructor("int", dim=3), 3) for (i in 1:3) { for (j in 1:3) { .JavaSetArrayElement(a, as.integer(i*j), i,j) } } print(.JavaGetArrayElement(a, 1,1)) } I expect that I should see 1 print out but instead I get [[1]] [1] 1 2 3 [[2]] [1] 1 2 3 The SJava manual seems to indicate that .JavaGetArrayElement(a, 1,1) gives the first element of the first array. Could anybody throw some light on this? A related question is the an array of Strings. Does .JavaArrayConstructor("String",3) give me an array of 3 Strings (which are not yet defined) or a String of length 3? Or if I need to allocate an array of Strings should I do: r <- .JavaArrayConstructor( "String", c(3,0) ) and then for each element of r add a new array and then finally set the individual elements to the actuial string values? Is there any example code available that I could take a look at? Thanks, ------------------------------------------------------------------- Rajarshi Guha <rxg218 at psu.edu> <http://jijo.cjb.net> GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE ------------------------------------------------------------------- Q: What's purple and commutes? A: An abelian grape.