这段程序会输出什么?

来自 注解
Java 25 LTS 进阶 2分钟

这段程序会输出什么?

Java
import java.lang.annotation.*;

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Repeatable(Labels.class)
@interface Label { String value(); }

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@interface Labels { Label[] value(); }

@Label("fast")
@Label("stable")
public class Main {
    public static void main(String[] args) {
        System.out.println(Main.class.getAnnotation(Label.class));
        System.out.println(Main.class.getAnnotationsByType(Label.class).length);
    }
}
在试验场中打开
报告错误