Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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?

Answers were Sorted based on User's Feedback



int i = 1; int j = 1; System.Console.WriteLine(i == j); System.Console.WriteLine(i.ToString() == ..

Answer / aspdev556

true
true
false

Is This Answer Correct ?    43 Yes 6 No

int i = 1; int j = 1; System.Console.WriteLine(i == j); System.Console.WriteLine(i.ToString() == ..

Answer / sahdev singh

True - First time we are comparing only values.
True - Second time also we are comparing only values.
False - We are comparing reference of two objects.

Is This Answer Correct ?    9 Yes 3 No

int i = 1; int j = 1; System.Console.WriteLine(i == j); System.Console.WriteLine(i.ToString() == ..

Answer / pp

provide the answer please

Is This Answer Correct ?    6 Yes 2 No

int i = 1; int j = 1; System.Console.WriteLine(i == j); System.Console.WriteLine(i.ToString() == ..

Answer / sasi

static void Main(string[] args)
{
int i = 1, j = 1;
Console.WriteLine(i + j);
Console.WriteLine("\n" + i.ToString() + j.ToString());
Console.WriteLine("\n"+((object)i==(object)j));
Console.ReadLine();
}
output:-
2
11
false

Is This Answer Correct ?    4 Yes 1 No

int i = 1; int j = 1; System.Console.WriteLine(i == j); System.Console.WriteLine(i.ToString() == ..

Answer / 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

More C Sharp Interview Questions

What is instantiating a class?

0 Answers  


Can extension methods access private members?

0 Answers  


How do you inherit from a class in C#?

3 Answers   Visual Soft,


What is internal and protected-internal accessspecifier in c#.net?

1 Answers  


Where do we use static class in c#?

0 Answers  


How many variables do you need?

0 Answers  


What is a dbml?

0 Answers  


What are delegate methods?

0 Answers  


What’s the difference between System.String and System.Text.StringBuilder classes with example

2 Answers  


Write the difference between TypeOf and GetType?

0 Answers   Wipro,


Can we have 2 main methods in c#?

0 Answers  


What is int32?

0 Answers  


Categories