inner class within Interface

2019-01-03 12:17发布

is that possible to create a inner class within an interface? If yes, why do we create like that? Anyways we are not going to create any interface objects?

Do they help in any Development process?

13条回答
▲ chillily
2楼-- · 2019-01-03 13:15

An interesting use case is to provide sort of a default implementation to interface methods through an inner class as described here: https://stackoverflow.com/a/3442218/454667 (to overcome the problem of single-class-inheritance).

查看更多
登录 后发表回答