Examveda

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();
    }
}

A. 10 20
5 25

B. 20 10
25 5

C. 10 20
5 125

D. 20 10
125 5

Answer: Option C


Join The Discussion

Related Questions on Classes and Objects in C Sharp