I know how to do toString method for one dimensional arrays of strings, but how to print two dimensional array ? With 1D I do it this way :
public String toString() {
StringBuffer result = new StringBuffer();
res = this.magnitude;
String separator = "";
if (res.length > 0) {
result.append(res[0]);
for (int i=1; i<res.length; i++) {
result.append(separator);
result.append(res[i]);
}
}
return result.toString();
How to print 2D array.