The java interface statement

Recommended for you: Get network issues from WhatsUp Gold. Not end users.

I use a tool: Java Decompiler decompile tool package jar source code, the following code:

1 public abstract interface AbsITest{}

In the online search:

I've made a test in this case:

The project structure and the JRE environment:

Effect of operation:

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

Part of the code:

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

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

 1 /**
 2  * 
 3  */
 4 package com.test;
 5 
 6 /**
 7  * The interface statement
 8  * @author hongten()<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  * Ordinary class can achieve two interfaces we defined
 8  * @author hongten()<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  * We usually written interface
 8  * @author hongten()<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 }

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Spark at November 18, 2013 - 6:54 PM