Java Bcom

Page 5

dat.i abstTaction.

use the concept of abstraction. and are defined with (variables) and methods (finctions) Casses

a list of

data ilems

Eneapsulation:

4.

Data

Cncapsulation

is

most important feature of class.

process of combining data and methods (functions) Encapsulation.

The

The

.By 5.

in a single unit is known as

data of a class is aecessed by only the methods of same class. using encapsulation. we can accomplish data hiding.

Inheritance:

The process of ereating a new class from old class is called inheritance. Inheritance is very useful to add additional features to an existing class without moditying it,.

.The new class will have the combined features of new class and old class. orz .New class is called derived class or sub class and old class is called super class baseclass. Bird

Feathers eggs

Non-Flying

Flying

Robln

6. Polvmorphism:

Crow

Kiwi

a

to take more than one form with single name. "morphism" comes from the "Greek' word. "Poly" means "many" and

Polymorphism means the ability

"Polymorphism"

means "forms". i.e., many forms. in two more purposes. It's a quality that allows one name to be used data. An action is depends on the type of the Shape polymorphisms. There are two types of Draw() 1. Compile-time polymorphism. 2.

Run time polymorphism. Circle object

Box object

Triangle object

Draw(circle)

Draw(box)

Draw (Triangle)


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.