Lesson 2 - Elementary Concepts of Classes and Objects
Lesson 2 - Elementary Concepts of Classes and Objects
Elementary Concept of
Objects and Classes
1. Real World Objects or Entity
2. Class Objects
3. Differentiate between real world
objects and class objects
4. Message Passing
5. Relation between class and object
As, you have learnt about Java Object
Oriented Programming in your previous
class, could you please think about the
answers for the following?
1.What do you mean by Object Oriented
Programming?
2. Why is an object so important in Java
programming language?
3. Differentiate between Java Compiler
and JVM.
An entity can be a real-world
object, either living or non-
living, that can be easily
identifiable. Each and every
thing is known as Entity. An
Entity contains some
characteristics and behavior.
We call entities as objects in our
programming language.
Example : a student, a table , a
bank account.
A class may be regarded as a blueprint to
create objects. It may be viewed as a
factory that produces similar objects. A
class may also be considered as a new
data type created by the user, that has its
own functionality. Objects bind data
members (attributes) and functions
(behavior) together.
class Dog (the blue Objects( Actual Instances)
print)
BROWNIE
PROPERTIES METHODS
Colour Sit
Eye colour Lay down
Height Eat
Length Come
weight Jump TOMY
Breed Run
class Tata (the blue print)
NANO
SAFARI
Real world objects have Software objects
physical characteristics also have
(state and behaviour) characteristics and
Ex: Motor bike has behaviour. The
characteristics like two characteristics are
wheels, number of maintained through
gears and behaviour variables or data
items whereas
like breaking and
behaviour is
changing the gears etc.
maintained through
functions/methods.
1) Defines the common data and methods as
single unit that will be shared by set of objects.
2) A class is a blue print that defines the
variables and the methods common to all
objects.
3) A class is a collection of objects of similar
type.
Like a factory contains raw material and
procedures to make a product , similarly a class
contains various types of data(variables) and its
associated methods. These class members will
be shared by set of objects.
What do you mean by message passing?
Exchange of information and data between
two objects.
Example :
1)People communicate with each other.
2)Government work through many different
Ministries.
Does our stereo kept
on a table work by
itself?
On
Stereo
STEREO