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
What is method overriding in c#
What is stringbuilder c#?
Why do we use ienumerable in c#?
What is Wrapper class in dot net?
How many types of polymorphism are there?
What's different between c# and c/c++?
Define encapsulation?
What does using do in c#?
What is the importance of closing an ado.net application?
Difference between abstract classes and interfaces
Are c# references the same as c++ references?
who is a protected class-level variable available to?
Explain about ODP.net
Explain 'structure padding'?
What is CASPOL?