adplus-dvertising
frame-decoration

Question

What is output of the following section of code ?
class abc
 {
     public static void a()
     {
         console.writeline("first method");
     }
     public void b()
     {
         a();
         console.writeline("second method");
     }
     public void b(int i)
     {
         console.writeline(i);
         b();
     }
 }
 class program
 {
     static void main()
     {
         abc k = new abc();
         abc.a();
         k.b(20);
     }
 }

a.

second method
20
second method
first method

b.

first method
20
first method
second method

c.

first method
20

d.

second method
20
first method

Posted under C# programming

Answer: (b).first method
20
first method
second method

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is output of the following section of code ?