The document explains the concepts of objects and classes in programming, defining an object as an identifiable entity with characteristics and behavior, and a class as a blueprint for objects. It details how methods/functions implement behavior and variables implement characteristics, along with the syntax for creating objects. Additionally, it covers access specifiers in Java and the distinction between class/static variables and instance variables.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
9 views1 page
Class 10 Computer Ch-2 Notes
The document explains the concepts of objects and classes in programming, defining an object as an identifiable entity with characteristics and behavior, and a class as a blueprint for objects. It details how methods/functions implement behavior and variables implement characteristics, along with the syntax for creating objects. Additionally, it covers access specifiers in Java and the distinction between class/static variables and instance variables.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1
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;