You can do two things.
1. Create another String but initialize it before the while loop. and then in the while loop when you are creating the new string, append the newly created string in the string created above.
2. Use the string builder class. Declare it out before the while loop. Then in the while loop simple append the newly created string, the one you are doing currently, into the string builder object. Then you can get all the appended strings from the string builder object by calling the
Ok now your question is more clear. I thought you wanted to append the string value.
Well yes I will agree with the post above that you can't really do that in run time. And what you are asking for isn't efficient coding. If appending the strings is what you really need then I have answered that. You may use list for storing separate strings.
But I am also confused why would you need to do something like that.
A string buffer is like a String, but can be modified. At any point in time it contains some particular sequence of characters, but the length and content of the sequence can be changed through certain method calls.
I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...
Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...