Can anyone explain what is the need of marker interface?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can anyone explain what is the need of marker interface??

Marker interface in java has no methods then what is use of it??

10th Oct 2022, 5:49 PM
Shreepriya HA
2 Answers
+ 4
Even though there are no methods, but the presence of these interfaces affect the runtime behaviour of these object which inherit them. In more modern Java, the same concept is usually expressed by using annotations. More details: https://www.baeldung.com/java-marker-interfaces
10th Oct 2022, 6:14 PM
Tibor Santa
Tibor Santa - avatar
+ 2
Sololearner may not perform well for this or even affect other activities, but it has the https://play.google.com/store/apps/details?id=com.serakont.appbuilder2 where you can make your interface or even publish your app It's a little difficult but if you understand visual studio you can use it without any problems.
10th Oct 2022, 7:20 PM
Félix Zamdamela
Félix  Zamdamela - avatar