java类中定义接口

时间:2023-03-09 02:48:59
java类中定义接口

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

 package com.gxf.test;

 public class Test_interface {
public interface show{
public void show();
}
static class TestInterface implements show{ @Override
public void show() {
System.out.println("this is interface!"); } } public static void main(String []args){
TestInterface testInterface = new TestInterface();
testInterface.show();
}
}