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 public void in c#?
What can we do to handle multiple exceptions?
What is anonymous methods in c#?
What's different between c# and c/c++?
Explain about generics in c#.net?
What do you mean by parsing and how to parse a date time string in c#?
Explain the difference between directcast and ctype.
How big is a float?
How can I use .NET components from COM programs?
What are cookies in c#?
Is there throws keyword in c#?
Explain how do you directly call a native function exported from a dll?
What is the use of tuple in c#?
Contrast between an interface and abstract class?
Could you explain the difference between func vs action vs predicate?