What will be the output of the following C# code?
public class sample
{
    public static int x = 100;
    public static int y = 150;
}
public class newspaper :sample
{
    new public static int x = 1000;
    static void Main(string[] args)
    {
        console.writeline(sample.x + "  " + sample.y + "  " + x);
    }
}
        public class sample
{
    public static int x = 100;
    public static int y = 150;
}
public class newspaper :sample
{
    new public static int x = 1000;
    static void Main(string[] args)
    {
        console.writeline(sample.x + "  " + sample.y + "  " + x);
    }
}A. 100 150 10
B. 1000 150 1000
C. 100 150 1000
D. 100 150 100
Answer: Option C
Related Questions on Classes and Objects in C Sharp
A. A blueprint for creating objects
B. A method in C#
C. A variable in C#
D. A data type in C#
A. A method in C#
B. A variable in C#
C. An instance of a class
D. A data type in C#
A. public
B. private
C. protected
D. internal

Join The Discussion