Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

java - What is the use of an empty abstract class?

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...