Will the following code compile (as part of a method):
 
string[] str = new string[5]; 
try 
{ 
     str[4] = "anything"; 
} 
catch (Exception e) 
{ 
     Console.WriteLine(e.Message); 
} 
catch (IndexOutOfRangeException e) 
{ 
     Console.WriteLine(e.Message); 
}
 
Explanation
Code will not compile.
Exception handling must be in ascending order through the hierarchy of exceptions (from child classes to superclasses).

Слідкуй за CodeGalaxy

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

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