views:

50

answers:

1
String s = "test";

String is a class, so to use it we should create an object of it. But rather we just make a reference of it and give it a value. How is it possible and what concepts are used in it.

The metadata of String class shows the following :

public sealed class String : IComparable, ICloneable, IConvertible, 
IComparable<string>, IEnumerable<char>, IEnumerable, IEquatable<string> {...}

Kindly explain. Thanks in advance.

+1  A: 

Please see following post at SO

http://stackoverflow.com/questions/2455274/why-string-is-a-reference-type

saurabh
Thanks Saurabh. It was the exact thing i was looking for ... this question was asked me in NIIT.
HotTester