开发者

We just create a reference of string class without making a object of it and start using it, how is it possible?

开发者 https://www.devze.com 2023-01-15 03:10 出处:网络
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
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 o开发者_运维技巧f String class shows the following :

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

Kindly explain. Thanks in advance.


Please see following post at SO

Why string is a reference type, but behaves differently from other reference types?

0

精彩评论

暂无评论...
验证码 换一张
取 消