Uebungsaufgaben_ITFS_3_SS_2025/Exercises/E32_Exceptions/Exercise_2.cs
s.schueler.doz 8b634a0758 E32 Ex1 - 4
2025-03-03 12:52:42 +01:00

41 lines
1013 B
C#

using System;
namespace Exercises_C_Sharp.E32_Exceptions
{
class Exercise_2
{
public static void Start()
{
//Sichern sie die Console.ReadLine()-Methode ab, sodass alle Exceptions abgefangen werden. Geben Sie dann die jeweilige Exception aus:
//Code START
try
{
//Code ENDE
Console.ReadLine();
//Code START
}
catch(IOException ex)
{
Console.WriteLine(ex.ToString());
}
catch(OutOfMemoryException ex)
{
Console.WriteLine(ex.ToString());
}
catch(ArgumentOutOfRangeException ex)
{
Console.WriteLine(ex.ToString());
}
//Kann auch nur der einzige Catch sein:
catch(Exception ex)
{
Console.WriteLine(ex.ToString());
}
//Code ENDE
}
}
}