Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the use of an empty abstract class?

Tags:

java

oop

I want to know that is there any use of empty abstract class in Java? If so, what is it?

like image 332
pankaj Avatar asked Sep 28 '12 04:09

pankaj


1 Answers

An empty abstract class is very much equivalent to an interface except that it can extend a class

abstract class myAbstractClass // extends anotherClass implements anInterface
{

}

interface myInterface // extends anotherInterface
{

}

This pattern is called Marker interface and SO has a lot of good data about it already: What is the purpose of a marker interface?

like image 156
Azodious Avatar answered Oct 13 '22 00:10

Azodious