java中interface的完整表述

我用一个工具:java Decompiler反编译工具查看jar包源码的时候,出现了以下代码:

1 public abstract interface AbsITest{}

在网上搜索了一下:

我对这种情况作了一下测试:

项目结构以及jre环境:

运行效果:

==================================================

代码部分:

==================================================

/UUUUU_Test/src/com/test/AbsITest.java

 1 /**
 2  * 
 3  */
 4 package com.test;
 5 
 6 /**
 7  * interface的完整表述
 8  * @author hongten(hongtenzone@foxmail.com)<br>
 9  * @date 2013-7-9
10  */
11 public abstract interface AbsITest{
12 
13     public static final String NAME = "Hongten";
14     /**
15      * method of get name
16      * @return name
17      */
18     public String getName();
19 }

/UUUUU_Test/src/com/test/CTest.java

 1 /**
 2  * 
 3  */
 4 package com.test;
 5 
 6 /**
 7  * 普通类可以实现我们定义的两个接口
 8  * @author hongten(hongtenzone@foxmail.com)<br>
 9  * @date 2013-7-9
10  */
11 public class CTest implements AbsITest,ITest{
12 
13     public int getAge() {
14         return ITest.AGE;
15     }
16 
17     public String getName() {
18         return AbsITest.NAME;
19     }
20     
21     public static void main(String[] args) {
22         CTest cTest = new CTest();
23         int age = cTest.getAge();
24         String name = cTest.getName();
25         System.out.println("name : "+ name + "  age : "+ age);
26     }
27 
28 }

/UUUUU_Test/src/com/test/ITest.java

 1 /**
 2  * 
 3  */
 4 package com.test;
 5 
 6 /**
 7  * 通常我们所写的interface
 8  * @author hongten(hongtenzone@foxmail.com)<br>
 9  * @date 2013-7-9
10  */
11 public interface ITest extends AbsITest{
12 
13     public static final int AGE = 20;
14     /**
15      * method of get age
16      * @return age
17      */
18     public int getAge();
19 }
原文地址:https://www.cnblogs.com/hongten/p/hongten_interface.html