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
How can I get the ascii code for a character in c#?
What is verbatim string literal in c#?
Explain about finalize method?
What is the difference between proc. Sent by val and by sub?
What is the difference between method and function in c#?
What is the interface in c#?
Is a valid int value?
Differentiate between response.expires and response.expiresabsolute?
What's your approach to fetch static data in your windows form application?
Name which controls do not have events?
Can we set image Source dynamically using C# in WPF application?
Why do we need structs in c#?
Can you explain template pattern?
Explain the clr triggers?
Which are access modifiers available in c#?