Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

classes & objects

 
Bharat Reddy ALLA
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the difference between classes and objects in core java?
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a class

Class X
{}

The following code creates an object of class X in the JVM memory

X x = new X();
 
Sunny Jaiswal
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To start with, think of class as an "Idea", it is something that is different from others and has a unique behavior, it can be a person, an aircraft or anything else. The objects are just the example of that given idea, like you and me or a Sukhoi-30. In other words, a class is a blueprint from which objects are constructed. The objects represents the particular instance of that class, like people belonging to the same city, and the aircraft's produced of a given type.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic