CLASS - 10
CHAPTER – 2
Object - Object is an identifiable entity with some characteristics and behaviour.
Objects in software terms -
• Behaviour is implemented through methods/functions.
• Characteristics are implemented through variables.
• Data and methods are encapsulated into one unit called class.
Class - A class is a blueprint of a set of objects that have a common structure and common
behaviour.
Object as an instance of a class - An object gets its own copy of data members and methods
based on class details, that is why an object is called an instance of a class.
Syntax to create object - <class name> <object name > = new <class name>();
Method/Function - A function is a collection of statement that are grouped together to
perform an operation. It is called/accessed by name.
Calling a method through object - object name.method name ( parameters if any );
E.g. obj1.calc();
Access specifiers - It specifies the accessibility or scope of a class member and determines
whether a method or a data variable can be accessed by another method in another class or
subclass.
Types of access specifiers - Java provides four types of access specifiers.
• public- accessible by any other class anywhere.
• private- accessible only within the class.
• protected- accessible by the package classes and any subclass that are in other package.
• Default (no specifier)
Class or static variables - It is a variable that is declared once for a class. All objects of the class
share a single copy of them available in memory. It requires a static keyword for declaration.
E.g. static int age;
Instance variable - It is a variable that is created for every object of the class. It does not
require any keyword. E.g. int age;