larva
Explore posts from serversExam Prep OOP(Constructors , Inheritance , interface , polymorphism , Exception Handling
Console.WriteLine("Hello, World!");
int x = Convert.ToInt32(Console.ReadLine());
try
{
if(x < 0)
{
throw new OutofBounds();
}
if (x > 1000)
{
throw new OutofBounds();
}
} catch(OutofBounds ob) when ( x < 0) { Console.WriteLine("hi"); } catch(OutofBounds ob) when (x > 1000) { Console.WriteLine("Hello"); }
} catch(OutofBounds ob) when ( x < 0) { Console.WriteLine("hi"); } catch(OutofBounds ob) when (x > 1000) { Console.WriteLine("Hello"); }
317 replies