int i = 1;
int j = 1;
System.Console.WriteLine(i == j);
System.Console.WriteLine(i.ToString() == j.ToString());
System.Console.WriteLine((object)i == (object)j);
Give the sample code above, what is the output to the console?

Answer Posted / manoj yadav

1.TRUE... here we only comparing two value. if it is true.
then it wil execute (1==1).
2. TRUE.. here first we convert the int value in to string.
as bothe value are same so converted value wl also same
string so
3. WRONG..here we first give a reference to object. as
bothe objects reference cant be same so FALSE

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between ienumerable and enumerable?

675


What is the difference between array and arraylist in c#?

727


Is array immutable in c#?

654


What is a verbatim string literal and why do we use it?

700


Define sealed classes in c#?

701


What is parseexact c#?

689


Why we use get and set property in c#?

698


Define delegation in .net?

666


Can constructor be overloaded in c#?

653


Define multicast c# delegate?

735


what are the differences between a class and structure

758


Explain how to implement an object pool in c#.net

715


How many constructors can a class have in c#?

681


What is the use of tryparse in c#?

676


What are the 3 different types of arrays?

783