Abstraction against abstract class and interfaces

I was thinking about reading about abstraction, and I was really embarrassed reading various posts on it.

So, here are my questions that I cannot understand:

1) "Abstraction is achieved through the use of an abstract class and interface?" I searched about this, and I had three types of answers:

  • Which vary as described here .
  • They are the same, but just different points of view, as described here .
  • And the last abstract class is used to achieve type abstraction here .

Which one is true? A simple example.


2) "Abstraction means hiding unnecessary details. How to focus on what the object does, and not how to do it."

Is it correct?


3) . In abstract classes, we can define a specific implementation and only the signature of the method, and we force the developer (who uses the abstract class) to write implementations on their own. So how can this be an abstraction if he writes his own implementation? I thought that abstraction should hide the implementation. And in the interfaces, the developer has to write every implementation of the method.

So where does abstraction come here?


4). " , " - . / " " ().

?


, / , .

!

+4
1

- , .

: (Ethernet, Wi-Fi, ATM, ..), - , , . , " " - , Ethernet Wi-Fi .. - .

, - . , ; .

- , , , ​​ , , . , , , , , . , ( , factory ..) - , ; , () , ( , ..).

3) , ( ) . , , ? , . .

, ?

() . , ; , , , List<String>, , ArrayList LinkedList, .

, ; , , "" . ( , "" Javadoc, .)

+2

Source: https://habr.com/ru/post/1657318/


All Articles