What will be the output of the following C# code snippet? [code] class access { public int x; private int y; public void

Ngoc Hue

New member
What will be the output of the following C# code snippet?
Code:
 class access
 {
     public int x;
     private int y;
     public  void cal(int a, int b)
     {
         x = a + 1;
         y = b;
     }
 }    
 class Program
 {
     static void Main(string[] args)
     {
         access obj = new access();   
         obj.cal(2, 3);
         Console.WriteLine(obj.x + " " + obj.y);     
     }
 }
A. 3 3
B. 2 3
C. Run time error
D. Compile time error
 

Tìm kiếm

Back
Top