java类中定义接口

时间:2014-08-29 21:23:18   收藏:0   阅读:318

今天看到一个java类中定义了接口,写个备忘录,记录一下

 1 package com.gxf.test;
 2 
 3 public class Test_interface {
 4     public interface show{
 5         public void show();
 6     }
 7     static class TestInterface implements show{
 8 
 9         @Override
10         public void show() {
11             System.out.println("this is interface!");
12             
13         }
14         
15     }
16     
17     public static void main(String []args){
18         TestInterface testInterface = new TestInterface();
19         testInterface.show();
20     }
21 }

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!