0% found this document useful (0 votes)
23 views3 pages

Assignment of CH-4 Class-XII Informatics Practices

The document defines key concepts related to object oriented programming in Java such as class, object, methods, polymorphism, inheritance, abstract class, concrete class, method overloading, operator overloading, super class, sub class, native class, base class and procedural programming. Examples are provided for polymorphism, inheritance, method overloading and operator overloading.

Uploaded by

Ishu Miglani
Copyright
© © All Rights Reserved
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% found this document useful (0 votes)
23 views3 pages

Assignment of CH-4 Class-XII Informatics Practices

The document defines key concepts related to object oriented programming in Java such as class, object, methods, polymorphism, inheritance, abstract class, concrete class, method overloading, operator overloading, super class, sub class, native class, base class and procedural programming. Examples are provided for polymorphism, inheritance, method overloading and operator overloading.

Uploaded by

Ishu Miglani
Copyright
© © All Rights Reserved
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/ 3

Assignment of CH-4(BASICS OF OBJECT ORIENTED PROGRAMMING)

Class-XII
Informatics Practices

A. Define:
a. Oops
OOP concepts in Java are the main ideas behind Java's Object Oriented
Programming. They are an abstraction, encapsulation, inheritance, and
polymorphism. ... Basically, Java OOP concepts let us create working
methods and variables, then re-use all or part of them without
compromising security.

b. Class
Classes and Objects are basic concepts of Object Oriented Programming
which revolve around the real life entities. Class. A class is a user defined
blueprint or prototype from which objects are created. It represents the
set of properties or methods that are common to all objects of one type.

c. Objects
An object can be defined as an instance of a class, and there can be
multiple instances of a class in a program. An Object contains both the
data and the function, which operates on the data.

d. Methods
A method in object-oriented programming (OOP) is a procedure
associated with a message and an object.

e. Polymorphism with example


It is the ability of a method to execute in many forms. In object oriented
programming there is a provision by which an operator or a method
exhibits different characteristics depending upon different sets of input
provided to it. This feature in Object Oriented Programming is known as
polymorphism. Two examples of polymorphism are method overloading
and operator overloading.

f. Inheritance with example


Inheritance is a process of creating new class (derived class or sub class or
child class) from existing class (base class or super class or parent class).
The derived classes not only inherit capabilities of the base class but also
can add new features of their own. The process of Inheritance does not
affect the base class.

g. Abstract Class
The classes for which it is not essential to declare objects to use them are
known as abstract classes. JOptionPane is one of the examples of an
abstract class.

h. Concrete class
The classes for which objects are required to be declared are known as
concrete classes like JLabel, JTextField, JComboBox etc.

i. Method Overloading with example


Method overloading is where a method name can be associated with
different set of arguments/parameters and method bodies in the same
class. The round() method of the Math class and the substring() method
of the String class are good examples of method overloading. The
following examples explain how round() and substring() methods are
overloaded. If the argument passed to the round() method is of type
double then it rounds off the double value and returns the closest long
value. On the other hand, if the argument passed to the round() method
is of type float then it rounds off the float value and returns the closest
integer value. This simply means that the round() method is overloaded
on the basis of the type of arguments supplied to it.
float f = 12.5;
double d = 123.6543;
int num1 = Math.round(f); //num1 will store 13
float num2 = Math.round(d); //num2 will store 124.0

j. Operator Overloading with example


Operator Overloading is another example of polymorphism. Just as
methods can be overloaded, operators can also be overloaded. A very
good example of operator overloading is the + operator which returns
the sum of two numbers if the operands are numbers but returns the
concatenated string if the operands are characters or strings. For
example:
String A = "Hello", B = "There";
String C = A + B; //C will store HelloThere
int num1 = 10, num2 = 20;
int num3 = num1 + num2; //num3 will store 30
k. Super class
The derived class (the class that is derived from another class) is called a
subclass. The class from which it's derived is called the superclass. ... The
subclass inherits state and behavior in the form of variables and methods
from its superclass.

l. Sub class
The derived class (the class that is derived from another class) is called a
subclass.

m. Native class in java


A Java source file can define a class and its methods. Method functions
can perform computations and other operations based on the primitive
data types, array indexing, and string concatenation. They can also create
objects of other classes and call methods.
Java code cannot directly make calls to the local operating system to
access disk files, run programs, use network resources, or query
databases. Instead, such requests must be made indirectly through
a native class. Java supports native classes like Math and String with
predefined methods to make the programming process simpler.

n. Base class
A base class is a class, in an object-oriented programming language, from
which other classes are derived. It facilitates the creation of
other classes that can reuse the code implicitly inherited from the base
class . A base class may also be called parent class or superclass.Derived
class.

o. Computer Programming
Computer coding is the use of computer programming languages to
give computers and machines instructions on what actions to perform.
Coding is the way humans communicate with machines, and it allows us
to create software like programs, operating systems, and mobile apps.

p. Procedural programming
The focus of procedural programming is to break down
a programming task into a collection of variables, data structures, and
subroutines, whereas in object-oriented programming it is to break down
a programming task into objects that expose behaviour (methods) and
data (members or attributes) using interfaces.

You might also like