java类中定义接口

今天看到一个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 }

 

posted on 2014-08-29 21:02  luckygxf  阅读(832)  评论(0编辑  收藏  举报

导航