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
Обратная Связь
Cosmo
Зарегистрируйся сейчас
или Подпишись на будущие тесты