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

Слідкуй за CodeGalaxy

Мобільний додаток Beta

Get it on Google Play
Зворотній Зв’язок
Cosmo
Зареєструйся Зараз
або Підпишись на майбутні тести