Class & Object in JAVA
To learn java programs https://wordpress-343193-1101484.cloudwaysapps.com/interface-program
A class is a blueprint/ template for an object. A class contains data members and member methods.
An object is a unique entity that has state and behavior. An object is called an instance of the class.
To learn java programs
Interface program
Data members show the characteristic /properties /physical feature of an object.The member methods display(represent) the behavior of an object. From one class many objects of the same type can be created that is why a class is called an object factory.
All the objects of the class will have state and behavior. The data member represents the state and the member methods represent the behavior of an object of a particular class.
For example in a class student, age and student name, father name can be data member and payfees() and study() can be the member methods.
From the given class any number of objects can be created. All the objects of this class will have the same state(physical features) and behavior (functionality)
The values of all the states will be different for each object. The values given to the state is called an attribute.
A real-life example of a class and an object can be a map of a house and a real house.
The map of the house gives a blueprint of the house that will be constructed using the map of the house, the house is an object of the class-map, the object is an instance of a class map.
Here class map is something that is not a real thing, it is something abstract that cant be used in real life, but when an object is created from a class, it can be used in real life.
The syntax of a java class is as follows.
class Student
{
int age;
String stud_name;
String father_name;
void payfees()
{
}
void study()
{
}
}The syntax to create objects from the following class is as follows.
Student Pratikraj=new Student();
Student Anay= new Student();Both these objects will have data members that are mentioned in the class like age, stud_name, and father_name.
The values can be assigned to these data members in the following way.
Pratikraj.age=17;
Pratikraj.stud_name="Pratikraj";
Anay.age=17;
Anay.stud_name=" Anay";
The functions of this class can be called by the given syntax
Pratikraj.payfees();
Anay.study();For videos related to java programming
http://www.youtube.com/user/trushnatej
Related Posts
Continue learning with these related articles

Logic Gates for ISC Class 11: Truth Tables, Universal Gates, Half and Full Adder
ISC Class 11 Computer Science notes on logic gates: AND, OR, NOT, NAND, NOR, XOR and XNOR with truth tables, why NAND and NOR are universal gates, and half adder and full adder circuits with their Boolean expressions.
Decimal to Binary Conversion in Java: 3 Programs with Examples
How to convert a decimal number to binary on paper and in Java: three programs (String, place value and Integer.toBinaryString), binary to decimal, a dry run and common mistakes.
Sum of First n Natural Numbers in Java (Loop and Formula)
Find the sum of the first n natural numbers in Java with a for loop, a while loop and the formula n(n + 1)/2, with a dry run and the sums of even numbers, odd numbers, squares and cubes.