What is a static class? How is it different from an object?

A class in which everything (all fields and methods) is static is equivalent to an object. It has state and behavior. However – such an ‘object’ may not work – since everything about the object needs to be known at compile time. For e.g. – if the type of O.S. was one of the fields, it would need to be determined at runtime.

Why not just make every class static?

The strength of OO programming is in the fact that each instance of a given class can contain different data/behavior than another instance.  The only way to maintain state is to instantiate regular (non static) classes.

Anuj holds professional certifications in Google Cloud, AWS as well as certifications in Docker and App Performance Tools such as New Relic. He specializes in Cloud Security, Data Encryption and Container Technologies.

Initial Consultation

Anuj Varma – who has written posts on Anuj Varma, Hands-On Technology Architect, Clean Air Activist.