What will be printed out as a result of the following code execution:
 
static void Main(string[] args) {
     int a = 0; 
     decimal b = 0; 
     double c = 0.0; 

    Console.WriteLine(a == b);        
    Console.WriteLine(a.Equals(b));     
    Console.WriteLine(a == c);   \
    Console.WriteLine(a.Equals(c));     
    Console.ReadLine();
 }
 
Explanation
Equals for Int32 overridden in a way that it firstly checks if boxed object is int. It is false in case 2 and 4

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes