ExamVeda
Login
Home
Classes and Objects in C Sharp
?

What will be the output of the following C# code?
class maths
{
    public maths()
    {
        Console.WriteLine("constructor 1 :");
    }
    public maths(int x)
    {
        int p = 2;
        int u;
        u = p + x;
        Console.WriteLine("constructor 2: " +u);
    }
}
class Program
{
    static void Main(string[] args)
    {
        maths k = new maths(4);
        maths t = new maths();
        Console.ReadLine();
    }
}

Answer & Solution
Correct Answer: Option C
Let's discuss the solution. Join the discussion
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.