Examveda

What will be the output of the following C# code?
class test
{
    public void print()
    {
        Console.WriteLine("Csharp:");
    }
}
class Program
{
    static void Main(string[] args)
    {
        test t;
        t.print();
        Console.ReadLine();
    }
}

A. Code runs successfully prints nothing

B. Code runs and prints "Csharp"

C. Syntax error as t is unassigned variable which is never used

D. None of the mentioned

Answer: Option C


Join The Discussion

Related Questions on Classes and Objects in C Sharp