java中的接口和@interface有什么区别? [英] What's the difference between interface and @interface in java?
问题描述
自从上世纪 90 年代末在大学期间使用 JBuilder 以来,我一直没有接触过 Java,所以我有点脱节 - 无论如何,我本周一直在从事一个小型 Java 项目,并使用 Intellij IDEA作为我的 IDE,改变了我常规 .Net 开发的节奏.
I haven't touched Java since using JBuilder in the late 90's while at University, so I'm a little out of touch - at any rate I've been working on a small Java project this week, and using Intellij IDEA as my IDE, for a change of pace from my regular .Net development.
我注意到它支持添加接口和@interfaces,什么是@interface,它与普通接口有什么不同?
I notice it has support for adding interfaces and @interfaces, what is an @interface, and how does it differ from a normal interface?
public interface Test {
}
对比
public @interface Test {
}
我进行了一些搜索,但找不到大量有关@interface 的有用信息.
I've done a bit of searching, but couldn't find a great deal of useful info referring to @interface.
推荐答案
@ 符号表示注解类型定义.
The @ symbol denotes an annotation type definition.
这意味着它不是真正的接口,而是一种新的注释类型——用作函数修饰符,例如@override.
That means it is not really an interface, but rather a new annotation type -- to be used as a function modifier, such as @override.
在主题.
这篇关于java中的接口和@interface有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!