Well, you could consider a class as the place where the logic is and call it the logical entity. But a class can also contain data that is shared by all the objects, so there's also some storage going on (or something physical as you say it).
In any case, there's always only 1 of a certain class and there can be multiple objects that are based on that class. They hold specific instance data. But the class and the objects are all in memory (how would a function be called if a class didn't exist in memory?).
The way one could see it, objects hold the actual data of things that play a role in the world of the user and the class contains the functionality to work with that data.
Originally posted by ram kumar: I say class is a logical entity !
And objects are the physical entities of a class.
Fine. You can say that.
The terms "logical entity" and "physical entity" do not have any agreed meaning in the world of Java. Therefore, you can define them however you like. Do not expect others to know your definitions.
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Joined: May 22, 2008
Originally posted by Jesper Young: I don't know what you mean exactly with the terms "logical entity" and "physical entity". As far as I know these are not terms that are used very commonly in the Java world.
A class is a blueprint for objects: it describes how a certain kind of objects look (what data the objects made out of the class have and what operations you can do on that data).
As you said class is blueprint of objects, Agreed !
I too mean the same by saying logical entities.
Now i will put my question !
I had a doubt like, when class is said as blue print and only objects are physical entities.
How do static methods work ?
Now, everybody says that class exists in memory.
So, static methods will work with ease.
You mean to say that the .class file will be loaded in memory and not just the static methods ?
But i dont know why they have given the term "Blue print"
I think what we mean -- because several people have said it already -- is that the terms "logical entity" and "physical entity" can mean whatever you'd like them to mean, because they have no standard meaning in Java. Note that you'd have the same confusion if you were talking about things in the real world. A blueprint is a physical object that embodies a logical concept -- a plan for a house. A house is a physical object that embodies a logical concept: a lifestyle, the way in which people are intended to use it. See? It's a mess.
so you mean to say class is also a physical entity.
When you compile a Java source file, you create a "class" file. The class file is the blueprint. If you consider a "file" to be someting "physical", then a class is certainly a physical entity.
An instance of a class (aka object) is a temporary, in-memory implementation of the class.
To compare with the database world.
1. A class is equivalent to a table.
2. An object is equivalent to a record in the table. [ June 20, 2008: Message edited by: James Clark ]
Joined: Oct 13, 2005
What EF-H means is that we are straying on the boundary betweeen "physical" and "metaphysical." Stick with the notion of blueprint as mentioned earlier, and don't make things more complicated than they already are.
Joined: May 22, 2008
Originally posted by Campbell Ritchie: What EF-H means is that we are straying on the boundary betweeen "physical" and "metaphysical." Stick with the notion of blueprint as mentioned earlier, and don't make things more complicated than they already are.
Thanks, all. EFH , campbell and all. for clarifying.
Understood, java is a seperate world all terms are explanatory, to some extent. but has a different specific meaning by itself.