What is the use of abstract classes in java ? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 3

What is the use of abstract classes in java ?

I know that it is to hide complex data and enable only the simplest data but how does it work?

11th Aug 2017, 1:16 AM
Shanoor Afreen
Shanoor Afreen - avatar
3 Antworten
+ 3
An abstract class cannot be instantiated (but it has a constructor which is called when instantiating a children class ie. a concrete class). it is used as some kind of interface which would be already partly implemented or not (before java8). you can use an abstract class to define backbone code which is common for all the children/concrete classes and yet not directly instantiable. I have never seen any abstract classes in company code until now. it seems mostly interfaces are used, its more readable than extending an abstract class.
11th Aug 2017, 6:48 AM
Roland Sterkendries
Roland Sterkendries - avatar
+ 1
Thank u @Ronald sterkendries ...that was helpful
21st Aug 2017, 2:38 AM
Shanoor Afreen
Shanoor Afreen - avatar
- 1
ÎöÎáÎĺÎŤ
10th May 2020, 7:39 PM
-ÎŤÎÖÎŤÎĘ ÎöÎęÎĹά ÎŽÎĄÎĽ ÎĹÎíÎĘΜμÎč