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 are winforms in c#?

497


What is static void main in c#?

498


What is static and use of it?

467


Why do we use void in c#?

472


What is dll hell, and how does .net solve it?

533






What is marshalling and what are different kinds of marshalling?

495


What is private in c#?

485


What is the difference between firstordefault and singleordefault?

476


What is bitwise operator in c#?

507


how to implement a web service in .net

468


What is desktop application testing?

484


What are logical operators in c#?

522


Why do we need singleton pattern in c#?

485


What are the different types of delegates?

492


What is the default value of decimal in c#?

490