+ 2

what is true about static constructor ?

1. static constructor can have access modifiers. 2.only public keyword can be used for static constructor accessibility 3.static constructor can not have access modifiers

17th Sep 2017, 1:37 PM
owais shahab
owais shahab - avatar
3 ответов
+ 7
A static constructor is always called once on start (even before you create an instance of the class) And afterwards, even if you create an instance of that class a million times, the constructor wont respond at all. (Because static constructors are meant to just 'setup' a class only) So with that in mind: does it make sense to even place an access modifier to your constructor? If yes, does it honestly make any difference at all? and if no, you have your answer :V
17th Sep 2017, 1:47 PM
Wen Qin
Wen Qin - avatar
+ 1
thanks i've got my answer
17th Sep 2017, 2:03 PM
owais shahab
owais shahab - avatar
+ 1
well explain
17th Sep 2017, 2:03 PM
owais shahab
owais shahab - avatar