java中interface的完全表述   
               添加时间:2013-7-9 点击量: 
 
              我用一个对象: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 }
原来,再大的房子,再大的床,没有相爱的人陪伴,都只是冰冷的物质。而如果身边有爱人陪伴,即使房子小,床小,也觉得无关紧要,因为这些物质上面有了爱的温度,成了家的元素。—— 何珞《婚房》#书摘#
                     
                  
     
  
 
    
    
我用一个对象: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 }
原来,再大的房子,再大的床,没有相爱的人陪伴,都只是冰冷的物质。而如果身边有爱人陪伴,即使房子小,床小,也觉得无关紧要,因为这些物质上面有了爱的温度,成了家的元素。—— 何珞《婚房》#书摘#




