更新时间:2023-10-26 15:43:04
作为标记的接口在很大程度上被Java中的注释机制取代5或以后。它们允许您添加任意元数据。如果您的接口是空的并且仅用作类标记,那么您应该使用注释。
Interfaces as markers have largely been replaces by the annotation mechanism in Java 5 or later. They allow you to add arbitrary meta-data. If your interfaces are empty and are only serving to act as class markers, then you should be using annotations instead.