CO - IF - 22412 - CO1: Date: 05 February 2021 Learning at Your Doorstep
CO - IF - 22412 - CO1: Date: 05 February 2021 Learning at Your Doorstep
Written by
Yogita Jore
Head, Department of Information Technology (NBA Accredited),
Vidyalankar Polytechnic, Mumbai
Unit Outcome 1:
Write a program to create classes and
objects for the given problem.
Learning Outcome 1c:
Students should understand the
concept of Classes and Objects.
What we will learn today-Class and Objects
Key takeaways
1. Defining class
How to create object and class in Java?
2. Creating objects
Yogita Jore
Head, Department of Information Technology (NBA Accredited), Vidyalankar Polytechnic,
Mumbai
It is a basic unit of Object-Oriented Programming and represents the real life entities.
Object consists of following elements:
State: It is represented by attributes of an object. It also reflects the properties of an object.
Behavior: It is represented by methods of an object. It also reflects the response of an object with
other objects.
Identity: It gives a unique name to an object and enables one object to interact with other objects.
Syntax:
objectname . variablename = value;
objectname . methodname (parameterlist);
Example:
rect1.length=10;
rect1.width=20;
//creating an object
Rectangle r1 = new Rectangle();