Code 1 :
In the above program the reference variable 'a' is added to the list 'l'.
So when processing the list, the list return the 'reference' which points the value "a".
Q : am i right?.
Then,
code 2 :
here the reference variable 'a' is reused again at line 1.
i.e., pointing the reference variable 'a' to a value "b" or else to a new
string object "b".
again i add the reference variable to the list 'l'.
at last the list 'l' has two (same)reference variable.
so while processing the list 'l', how did the first value "a" is retrived as the reference varaible 'a' is pointed to a new string object "b" ?.