Home / C# Programming / Constructors :: Discussion

Discussion :: Constructors

  1. What will be the output of the C#.NET code snippet given below?

     namespace FreshergateConsoleApplication
     {   
       class Sample   
       {        
            public static void fun1()      
            {            
              Console.WriteLine("Gate1 method");          
            }     
            public void fun2()     
            {            
                fun1();              
                Console.WriteLine("Gate2 method");          
            }   
            public void fun2(int i)       
            {            
               Console.WriteLine(i);             
               fun2();    
            }    
       }    
       class MyProgram    
       {         
        static void Main(string[ ] args)         
        {             
             Sample s = new Sample();              
             Sample.fun1();     
             s.fun2(123);     
        }     
      }  
    }
    

     

     

  2. A.
     Gate1 method 
     123
     Gatel method
     Gate2 method
    B.
     Gate1 method 
     123 
     Gate2 method
    C.
      Gate2 method
      123
      Gate2 method  
      Gatel method
    D.
     Gatel method
     123
    E.
      Gate2 method
      123 
      Gatel method

    View Answer

    Workspace

    Answer : Option A

    Explanation :

    No answer description available for this question.


Be The First To Comment