Define the terms Class and Object with a small example.
Answers
Answered by
6
Answer:
CLASS are a blueprint or a set of instructions to build a specific type of object. It is a basic concept of Object-Oriented Programming which revolve around the real-life entities. Class in Java determines how an object will behave and what the object will contain.
OBJECT is an instance of a class. An object is nothing but a self-contained component which consists of methods and properties to make a particular type of data useful. For example color name, table, bag, barking. When you send a message to an object, you are asking the object to invoke or execute one of its methods as defined in the class.
EXAMPLE
- Class - Dogs
- Data members or objects- size, age, color, breed, etc.
- Methods- eat, sleep, sit and run.
Similar questions