Examveda

What will be the output of the following C# code?
static void Main(string[] args)
{
    int y = 3;
    y++;
    if (y <= 5)
    { 
        Console.WriteLine("hi");
        Main(args);
    }
    Console.ReadLine();
}

A. hi hi

B. hi

C. Stack overflow exception

D. None of the mentioned

Answer: Option C


Join The Discussion

Related Questions on Classes and Objects in C Sharp