When i was attending my first interview in my current company this question was asked by my technical manager to me.I answered like others because the class has static keyword so we can’t create object for the class.
Again he asked but why we can’t create object to the class declared as static.Then later i have done some analysis on this and i came with following answer.
Answer:- Before we know the answer of this we need to understand that how a CLR allocate memory to objects.
Let’s say we have a concrete class called Example so when we create object for this class we’ll use of new operator like following syntax
Example example = new Example();
As soon as CLR will come across new operator it will allocate new memory location for that class called Example at Runtime and you can access member of this class using its object dynamically.
Now when we delcare a class as static The meaning of static is fixed at compile time.So the memory for that class is allocated at compile itself then why we need to create again object to class and allocate memory at runtime.
That is the reason we can’t create object for static class.