String data = new String("Results: ");

data = data + 89;

A good answer might be:

Yes, the last statement constructs a new string.

String Objects are Immutable

Strings are immutable. The last statement constructs a new string containing the characters from the original string with additional characters at the end. After the statement has executed, data refers to the new string. The original string is now garbage.

String objects, once constructed, can never be changed. This has many advantages in making programs understandable and reliable. For example, if a method has a reference to a string, that string will always contain the same characters, no matter what other methods are called.

For this reason, a program that does only moderate amounts character of character manipulation should do it all using class String.

However, constantly creating new String objects and garbage collecting the old objects takes up significant time.

QUESTION 2:

A program is run from the command line as follows:

C:\>java myProgram "Input String"

When  main(String[] args)  starts running, what does

args[0]
refer to?

Click Here after you have answered the question