What will be the output of the following C# code snippet? [code] public class Generic<T> { Stack<T> stk = new Stack<T>(); public

What will be the output of the following C# code snippet?
Code:
public class Generic<T>
{
    Stack<T> stk = new Stack<T>();
    public void push(T obj)
    {
        stk.Push(obj);
    }
    public T pop()
    {
        T obj = stk.Pop();
        return obj;
    }
}
class Program
{
    static void Main(string[] args)
    {
        Generic<string> g = new Generic<string>();
        g.push(40);
        Console.WriteLine(g.pop());
        Console.ReadLine();
    }
}
A. 0
B. Runtime Error
C.
Code:
40
D. Compile time Error
 

Tìm kiếm

Back
Top