Static Constructor V/s Non-Static Constructor

Following are the difference between Static and Non-Static Constructor:-

  1. We have to use static keyword to create static constructor but for non-static constructor we do not need any special keyword.
  2. Static constructor can initialize only static variable but non-static constructor can initialize both static and non-static variable.
  3. Static constructor do not have any access specifier but non-static constructor have access specifier.

4. Static constructor call automatically when class load first time and we cannot call Static constructor using program. However, we call non-static constructor using program at the time of object creation.

5. We cannot overload static constructor, as it is parameter less constructor. We cannot pass parameter to static constructor. However, we can overload non-static constructor.

		public class abc
    public static int k;
    public int x, y;
    static abc()
        k = 10;

    public abc(int p, int q)
        x = p;
        y = q;

        k = 20;