1
Answer

Question about static object

Ask a question
hi guys,
 
I have a question, I have seen variable declaration like below and wondering why/how it's working. I was expecting an error and both new and static keywords are used together.
 
static Class1 obj = new Class1();
obj.SomeMethod();
 
Any idea why it's working and not giving any error?
 
Thanks,
Prakash

Answers (1)