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

Can struct inherit from class c#?

610


Is a char?

535


Is c sharp open source?

571


Could you explain the difference between func vs action vs predicate?

536


What is strong name in c# and how can we use it?

620






What are the different types of assemblies available and their purpose?

581


Is c# an array?

562


How to use session under class file of APP_Code folder?

593


What are the differences between system.string and system.text.stringbuilder classes?

588


Is c# good for beginners?

555


What are variables in c#?

600


What is class in oops with example in c#?

582


What is thread.sleep()?

590


What is int32 in c#?

583


Explain the difference between and xml documentation tag?

582