What will be the output of this program?
using System;
class Class2
{
Class2()
{
static int i;
i++;
Console.WriteLine(i);
}

static void Main()
{
Class2 a = new Class2();
Class2 b = new Class2();
}
}

 Posted by Ddd on 1/17/2011 | Category: .NET Framework Interview questions | Views: 2716 | Points: 40
Answer:

Compiler error "Modifier static is not valid for this item"

static variables are declared at Class level.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response