• Post Reply Bookmark Topic Watch Topic
  • New Topic

definition of an object  RSS feed

 
Alex Kravets
Ranch Hand
Posts: 476
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How would one define what an object is? Is it an instance of a Class? But than we can have static class and there is no instance of it, right? Then what is definition of a Class? Is it blueprint for an object?
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I like two of your phrases a lot. Saying an object is an "instance of a class" is standard language. And saying a class is a "blueprint" for building classes is a neat way to think about things. At least for a while.

These metaphors break down a bit with static stuff, because you can use variables and methods that are on the blueprint without ever creating an instance. The JVM creates an object to represent the blueprint, built from yet another blueprint called Class. You can ignore the Class object a lot of the time, but when you need to use it - say for reflection - just remember it's another object like any other.

Hope that helps. Lemme know if it was just more confusinger.
 
Alex Kravets
Ranch Hand
Posts: 476
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Understood, thanks. It's just after a while (may be it's just me) I tend to take certain concepts for granted and just think of things as they are...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!