✔ 예외 :
잘못된 값의 입력 또는 추출
,프로그래머의 코딩오류
,예측할 수 없는 오류
등
✔try
,catch
,finally
를 통해 오류를 예측하고, 후속 처리 할 수 있음
string a = "";
a = Console.ReadLine();
int[] asd = { 0, 1, 2, 3 };
Console.WriteLine(asd[Int32.Parse(a)]);
try
{
int[] asd = { 0, 1, 2, 3 };
Console.WriteLine(asd[4]);
}
catch(Exception e)
{
Console.WriteLine("오류발생");
Console.WriteLine(e.ToString());
}
finally
{
Console.WriteLine("오류 발생유무와 상관없이 출력");
}