ExamVeda
Login
Home
Classes and Objects in C Sharp
?

What will be the output of the following C# code?
class z
{
    public int X;
    public int Y;
    public  const int c1 = 5;
    public  const int c2 = c1 * 25;
    public void set(int a, int b)
    {
        X = a;
        Y = b;
    }
 
}
class Program
{
    static void Main(string[] args)
    {
        z s = new z();
        s.set(10, 20);
        Console.WriteLine(s.X + " " + s.Y);
        Console.WriteLine(z.c1 + " " + z.c2);
        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.