strArray[0] = "Good-by" ;
This will replace the reference in slot 0 with a reference to a new String, containing the characters "Good-by" .
Each slot of an array of object references works just like an ordinary
object reference variable.
In the question, strArray[0]
starts out with a reference to one
String, then is assigned a reference to another.
The first String is now garbage.
Here is the familiar signature of the
main()
public static void main( String[] args )
The pharse
String[] args
main()
main()
C:\>java StringDemo stringA stringB stringC
The picture shows what the parameter args
looks
like while
main()