How many objects does A good answer might be:The length of the input string, plus one. |
One New Object per CharacterWhen the input is "This is argument 0" 19 strings are constructed (including the first, empty string) because each time the following statement executes, a new string is created.
As the statement starts to execute While fine for programs that do moderate character manipulation, such abundant construction of objects will slow down a program that does a great deal of character manipulation. Such programs are word processors, compilers, assemblers, data base programs, and many others. You will soon see a way to greatly speed up the example program. |
QUESTION 4:
Could an array of |