Explain static classes. Is Inheritance possible for a static class?

The answer is No. The following are the characteristics of a static class:

  1. Static classes can contain only static members.
  2. Are sealed by default - no other classes can extend a static class.
  3. Can't be instantiated. Cannot contain an instance constructor or a constructor with parameters.
  4. Creating a static class is similar to creating a class with all static members and a private constructor.
  5. Static classes can't extend from any other class other than Object.
  6. Static classes can contain static constructor, which is called before the first member of the static member is called.

The answer is No. The following are the characteristics of a static class:

  1. Static classes can contain only static members.
  2. Are sealed by default – no other classes can extend a static class.
  3. Can’t be instantiated. Cannot contain an instance constructor or a constructor with parameters.
  4. Creating a static class is similar to creating a class with all static members and a private constructor.
  5. Static classes can’t extend from any other class other than Object.
  6. Static classes can contain static constructor, which is called before the first member of the static member is called.
Default image
Sriram Mannava

I'm a full-stack developer and a software enthusiast who likes to play around with cloud and tech stack out of curiosity.

Leave a Reply