首页 > 代码库 > java类中定义接口

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         @Override10         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 }

 

java类中定义接口