When we talk about object oriented programming we say data and methods but why so?
- The answer is that an object has some properties and that properties represent the data.Like
Example:- Student object has some properties like name,age,roll_no etc so that is data about the object.
Lets see with program ,at this time do not bother about the code(if you are beginner):-
class Student
{
String name;
int age;
int roll_no;
}
So you can see that a student can have name,age,roll_no etc. So this is data about the student.
- Now second come methods(functions),the methods are the operations which are performed on the data of the object.