Home / MCQ Bank / Computer
Computer Classes And Objects In C Sharp Difficulty: Medium

What will be the output of the following C# code? class A { public int i; public void display() { Console.WriteLine(i); } } class B: A { public int j; public void display() { Console.WriteLine(j); } } class Program { static void Main(string[] args) { B obj = new B(); obj.i = 1; obj.j = 2; obj.display(); Console.ReadLine(); } }

Select the correct option to test your answer:

More Computer Questions

Which function is not called in the following C program? #include <stdio.h> void first() { printf("first"); } void second() { first(); } void third() { second(); } void main() { void (*ptr)(); ptr = third; ptr(); } Which format is not supported in Internet Explorer? What is the load factor for an open addressing technique? What will be the output of the following Java program? class X { int a; double b; } class Y extends X { int c; } class Output { public static void main(String args[]) { X a = new X(); Y b = new Y(); Class obj; obj = a.getClass(); System.out.print(obj.getName()); } } In Access press ALT+SPACEBAR to