Object Oriented Programming (OOP)
The advantages of object oriented software development are
Modular development of code, which leads to easy maintenance and modification. Reusability of code. Improved reliability and flexibility of code. Increased understanding of code.
Some of the advantages of using encapsulation are
The internal state of every objected is protected by hiding its attributes. It increases usability and maintenance of code, because the behavior of an object can be independently changed or extended. It improves modularity by preventing objects to interact with each other, in an undesired way.
Java is
a computer programming language that is concurrent, class-based and object-oriented.
A polymorphic type is
a type whose operations can also be applied to values of some other type.
(Abstraction)Java supports the creation and existence of
abstract classes that expose interfaces, without including the actual implementation of all methods.
(Encapsulation) Each object provides a number of methods, which can be
accessed by other objects and change its internal data.
Inheritance provides re-usability of code and can be used to
add additional features to an existing class, without modifying it.
Inheritance provides
an object with the ability to acquire the fields and methods of another class, called base class.
Abstraction and encapsulation are complementary
concepts. On the one hand, abstraction focuses on the behavior of an object. On the other hand, encapsulation focuses on the implementation of an object's behavior.
Object-oriented programming contains many significant features, such as
encapsulation, inheritance, polymorphism and abstraction.
Encapsulation provides objects with the ability to
hide their internal characteristics and behavior.
(Differences between Abstraction and Encapsulation)Encapsulation is usually achieved by
hiding information about the internal state of an object and thus, can be seen as a strategy used in order to provide abstraction.
(Encapsulation) Each modifier imposes different access rights to
other classes, either in the same or in external packages.
(Encapsulation) In Java, there are three access modifiers:
public, private and protected.
Abstraction is the process of
separating ideas from specific instances and thus, develop classes in terms of their own functionality, instead of their implementation details.
Polymorphism is
the ability of programming languages to present the same interface for differing underlying data types.