What will the following code print:
 
class Test { 
    static void increment(int p) 
    { 
      ++p; 
    } 
    static void Main( ) 
    { 
      int x = 8;
      increment(x); 
     Console.WriteLine(x++);
    } 
}
 
Explanation
X parameter is passed into the method by value. The value will be printed first and then incremented because in this case postfix operator is used

Follow CodeGalaxy

Mobile Beta

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