(Lesson 02)
What is Class
Class is abstract definition of data type. It includes the data elements that are part of the data type , and the operations which are defined on the data type.
It is an Entity which could be a thing, person or something that is imaginary.
- An entity can be described by the data (properties) and its behavior (methods)
What is Object?
Object is instance of class. Which can use to store data and perform actions.
We need to define a class including the properties(attributes) and methods.
Then create as many objects as needed which have the same structure of the class.
Ex :- This is Java Based Code
class Student {
private int studentNo;
private String name;
private int CA_mark;
private int final_mark;
public void assignMarks(int pCA, int pFin){
}
public int calculateTotal(){
}
public void printDetails(){
}
I think now you have an idea about what is a class and what is an object. In next article I will learn what is difference between private and public.
Good Day!