Sail E0 Webinar
Question
What will be the output of the given code snippet?class access{    public int x;    private int y;    public  void cal(int a, int b)    {        x = a + 1;        y = b;    }    public  void print()    {       Console.WriteLine(" " + y);        } }    class Program{    static void Main(string[] args)    {        access obj = new access();           obj.cal(2, 3);        Console.WriteLine(obj.x);        obj.print();        Console.ReadLine();    }}
Options:
A .  2 3
B .  3 3
C .  Run time error
D .  Compile time error
Answer: Option B





Submit Your Solution Below and Earn Points !
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers