+ 2
A class is not an object. But it is used to construct objects.
a)true b)false
5 Réponses
+ 2
True.
Think of a class as a BLUEPRINT. Just like with normal blueprints, you use them to create the objects in our world; similar to a template that defines what it is and how it behaves.
+ 2
object => physically exists
class => not
+ 2
See class as a container with an identity that can be accessed with an object when instantiated (created) to use the methods and attributes of the class
+ 2
saying class is used to construct object is ambiguous
0
It's not that simple. You can concider class as unique object for creating multiple class instances ('factory') and managing shared resources with class methods. Class handles such functionality as object serialization to send them remotely or store. Class object used to implement remote method call. Java implements reflection with idea of 'class as object'. Class is a way to extend runtime environment with new tools.