deepak carter wrote:
He told me that first statement create one object and second statement create two object.
First one creates zero objects. Second one creates one
String object, and one
char[] object. Possibly others, depending on what other members String has--no objects that I know of, but I can't be bothered to look it up.
(I hate it when interviewers give these "clever, tricky technical questions" when they don't even know the right answers themselves.