This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
This function, calling another function declared thusly:
gets this error:
./src/infoIsland/ReqTag.java:260: addButton(java.lang.String,java.lang.String,java.lang.String) in infoIsland.ReqTag cannot be applied to (java.lang.String,java.lang.String,java.lang.String) rtn+= addButton(btns[i], btns[i], btns[i]); ^
The bottom line is I want to pass in an indeterminate number of three-string arrays, then pass them as normal strings to another function. The reference I have says I can declare this:
Anyway, how DO you declare a 3xn string array, or, alternatively, an nx3 string array as a function argument?
Coming from C/C++? In Java an array is an object that has a property called lenght; it is not a simple block of memory. Therefore the issue with passing arrays as arguments to methods and not knowing how many elements they contain doesn't exist in Java.
> The reference I have says I can declare this:
Sounds like your reference is not very reliable; what you quote is utterly false.
In Java the brackets that declare an array can go behind both the type and the varible, so "String btns" declares a four-dimensional array of Strings. I think you meant to write "String btns" which would be only two-dimensional.
[ October 01, 2006: Message edited by: Joni Salonen ] [ October 01, 2006: Message edited by: Joni Salonen ]
Joined: Sep 04, 2006
Yes, many, many years at C/C++, a short time with Java!