Home >Java >Javagetting Started >what is java abstraction
In computer science, abstraction is a process in which data and program definitions are represented in a form similar to the connotative language represented while hiding implementation details.
Abstract: A concept or idea that is not tied to any specific concrete instance.
What is abstraction
Simply put: "Abstraction only reveals some relevant details of the object from the correct perspective."
In oriented In object programming theory, abstraction involves defining the language basis of an abstract object, how it works, how it obtains and changes state, and "communicates" with other objects in the system.
Abstraction plays a role in many aspects in any programming language. From creating subroutines to defining interfaces, generating low-level language calls such as design patterns.
Abstract form
Usually abstraction has two forms:
(1) Data abstraction
Data abstraction is to create complex Data types only expose meaningful operations that interact with the data type, hiding all implementation details from the outside world.
Benefits of this approach include the ability to improve the implementation over time, such as resolving performance issues. The idea is that these changes should not have any impact on client code because they do not involve abstract behavior.
(2) Control abstraction
Software is essentially a collection of large numbers of statements written in any programming language. Most of the time, the statements are similar and repeated multiple times.
Control abstraction is the process (extraction method) of identifying all these statements and presenting them as a unit of work. When we create a function to perform any work, we are usually abstracting.
How to use abstraction in Java
Abstraction is a core principle of object-oriented programming practice. Java has all OOPs principles. Abstraction is a main principle of Java language. Building blocks.
Data abstractions span from creating simple collections of data objects to complex implementations such as HashMap or HashSet. Similarly, control abstraction can be seen ranging from defining simple function calls to complete open source frameworks. Control abstraction is the main driving force behind structured programming.
The most commonly discussed about abstraction in Java are abstract classes and interfaces.
php Chinese website, a large number of free Java introductory tutorials, welcome to learn online!
The above is the detailed content of what is java abstraction. For more information, please follow other related articles on the PHP Chinese website!