Hello Everyone, I am woking on a Java project at the moment and feel that StringBuffer would help a lot in performing this particular task, where I am 'building' a string representation of a Matrix:
/**
* Returns a String representation of the Matrix using the getIJ getter
* function. You should use MaF.dF to format the double numbers to a
* sensible number of decimal places and place the numbers in columns.
*
* @return A String representation of the Matrix
*/
public String toString() {
//String stringBuilder = new String
StringBuffer beep = new StringBuffer;
for(i=0; i<m-1; i++){
for(j=0; j<n-1; j++){
}
// You need to fill in this method
}
I've tried it in a Java program by itself and it seemed okay, but then I tried some sample Java program from online java compiler and it didn't compile. Is StringBuffer
built into Java, or would it require importing a package? I am not allowed to import any packages for this project. Can anyone know, where am I wrong?