Static classes versus regular classes

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.

Specializing in high volume web and cloud application architecture, Anuj Varma’s customer base includes Fortune 100 companies (dell.com, British Petroleum, Schlumberger).
Anuj also offers a 1-day ‘technology crash course’ focused on cloud technologies for executives.
For Anuj’s specialized one-on-one executive seminars, visit ExecutiveTechnologySeminars
All content on this site is original and owned by anujvarma.com.

Anuj Varma – who has written posts on Anuj Varma, Technology Architect.


Leave a Reply

Your email address will not be published. Required fields are marked *