ARTICLE DETAIL

资讯详情

深耕郑州网站建设与运营推广的一线实战洞察。

Java 开发问题:类名与注解名冲突问题

Java 开发问题:类名与注解名冲突问题
  • 类名与注解名冲突,必须使用全限定名区分
publicclassTest{@org.junit.jupiter.api.Testpublicvoidtest1_1(){}}
  • 如果强制使用导入语句,则下述代码报错
  1. public class Test {处报错:'Test' is already defined in this compilation unit

  2. @Test处报错:Annotation type expected

importorg.junit.jupiter.api.Test;publicclassTest{@Testpublicvoidtest1_1(){}}
返回列表