Java OOPS Basics
17:47:00
Java
OOPs Concept
This tutorial
will help you to understand about Java
OOP’S concepts with examples. Let’s discuss about what are the features of
Object Oriented Programming. Writing object-oriented programs involves creating
classes, creating objects from those classes, and creating applications, which
are stand-alone executable programs that use those objects. A class is a
template, blueprint,or contract that defines what an object’s data fields and
methods will be. An object is an instance of a class. You can create many
instances of a class.
Note : In this page, we will learn about basics of OOPs. Object
Oriented Programming is a paradigm that provides many concepts such as inheritance, data binding,polymorphism etc.
"Object Oriented Programming
Concepts"
There
are 6 object oriented programming concepts in Java
which are given below.
which are given below.
- Class
- Object
- Encapsulation
- Polymorphism
- Inheritance
- Abstraction
Class
Class
is a collection of similar type of objects which have
some common properties.
some common properties.
Note: for more detail about class click here
Object
Object
is any real world entity which have physical
existence either living or non-living. Collection of objects is called class. It is a logical entity.
existence either living or non-living.
Note: for more detail about object click here
Encapsulation
The
wrapping up of data and functions into a single unit (class)
is known as encapsulation
is known as encapsulation
Note: for more detail about Encapsulation click here
Abstraction
Hiding the complexity and showing the functionality is known
as abstraction. Showing the essential data and hiding the non essential data.
as abstraction. Showing the essential data and hiding the non essential data.
Note: for more detail about Abstraction click here
.
Polymorphism
Polymorphism
is used to assume the ability of several
different forms. Or we can say performing one task in different ways.
different forms. Or we can say performing one task in different ways.
Note: for more detail about Polymorphism click here
Inheritance
Creating
a new class form an existing class is known as
inheritance. It provides code reusability.
inheritance. It provides code reusability.
Note: for more detail about Inheritance click here
Advantage of OOPs over
Procedure-oriented programming language:
1) OOPs
makes development and maintenance easier where as in Procedure-oriented
programming language it is not easy to manage if code grows as project size
grows.
|
2) OOPs
provides data hiding whereas in Procedure-oriented programming language a
global data can be accessed from anywhere.
|
3) OOPs
provides ability to simulate real-world event much more effectively. We can
provide the solution of real word problem if we are using the Object-Oriented
Programming language.
|
4) Objects
are modeled on real world entities
5) OOPS enables modeling complex systems of real
world into manageable software solutions.
What is difference between
object-oriented programming language and object-based programming language?.
1). Object based programming language
follows all the features of OOPs except Inheritance
2). JavaScript and VBScript
are examples of object based programming languages.
Difference between Procedure
Oriented Programming (POP) & Object Oriented Programming (OOP)
Programming
techniques
a) Unstructured Programming (Assembly language programming)
b) Procedural Programming (Assembly language, C programming)
c) Object Oriented Programming (C++, Java, Smalltalk, C#, Objective C)
Unstructured Programming
This consists of just writing the sequence of
commands or statements in the main program, which modifies the state maintained
in Global Data. Example: Assembly Language programs.
Limitations of Unstructured
Programming
a) The data is global and code operates on it
b) As the size of code increases, maintenance is a problem
c) Does not have independent data for processing
d) The concept of local variables did not exist
e) Reusability of code was not supported
a) The data is global and code operates on it
b) As the size of code increases, maintenance is a problem
c) Does not have independent data for processing
d) The concept of local variables did not exist
e) Reusability of code was not supported
Assembly Language: Similar
to machine language, but provides names for numeric instructions present in the
machine language, making it easy for the programmer.
Machine language is
the language which a Central Processing Unit (CPU) of a computer understands
and consists only of numbers.
0 comments