In the following C# code, which statements are perfectly valid?

public class Csharp
{
    public void subject<S>(S arg)
    {
        Console.WriteLine(arg);
    }
}
class Program
{
    static Void Main(string[] args)
    {
        Csharp c = new Csharp();
        c.subject("hi");
        c.subject(20);
    }
}

a) Run time exception error
b) Compile time error
c) Code runs successfully and prints required output
d) None of the mentioned

1 thought on “In the following C# code, which statements are perfectly valid?”

Leave a Comment