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’s training as a mathematical physicist followed by years of advanced computer programming is unique in the industry.

For Anuj’s popular technology seminars and science and scientific computing seminars, please visit ANUJ.COM

For Anuj’s Mathematical Models and Math Modeling related consulting , please visit anuj.com.

All content on this site is original and owned by AdverSite Web Holdings, Inc. – the parent company of anujvarma.com. No part of it may be reproduced without EXPLICIT consent from the owner of the content.

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 *