什么是接口和@interface在Java之间的区别? [英] What's the difference between interface and @interface in java?

查看:164
本文介绍了什么是接口和@interface在Java之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我没碰过的Java因为在90年代后期,而在大学JBuilder中使用,所以我不靠谱一点 - 在我一直在这个星期工作的一个小的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 {
}

VS

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.

请参阅关于这个问题的这个的javadoc进入

See this javadocs entry on the subject.

这篇关于什么是接口和@interface在Java之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆