A

Admin • 828.03K Points
Coach

Q. What will be the output?

Code:
string a = "Hello";
string b = "Hello";
Console.WriteLine(object.ReferenceEquals(a, b));
  • (A) True
  • (B) False
  • (C) Compilation error
  • (D) Runtime error

Explanation by: Admin
String literals are interned, so both variables refer to the same memory.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.