gpt4 book ai didi

java - Annotation 可以实现接口(interface)吗?

转载 作者:IT老高 更新时间:2023-10-28 20:51:54 24 4
gpt4 key购买 nike

注解中是否有可能实现接口(interface)?比如:

public @interface NotNull implements LevelInterface  {
ValidationLevel level();
};

最佳答案

不,编译器说:

Annotation type declaration cannot have explicit superinterfaces

你不能扩展:

Annotation type declaration cannot have an explicit superclass

关于java - Annotation 可以实现接口(interface)吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4722354/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com