[20-05-18][Thinking in Java 26]Java Inner Class 10 - Anonymous Inner Class 5
2021-01-18 10:16
标签:show pre thinking rgs void stat public his ack 结果如下: show [20-05-18][Thinking in Java 26]Java Inner Class 10 - Anonymous Inner Class 5 标签:show pre thinking rgs void stat public his ack 原文地址:https://www.cnblogs.com/mirai3usi9/p/12913845.html1 package test_16_3;
2
3 public interface Inter {
4
5 String show();
6 }
1 package test_16_3;
2
3 public class Outter {
4
5 public Inter inter() {
6 return new Inter() {
7
8
9
10 @Override
11 public String show() {
12 System.out.println("show");
13
14 return "this is Outter.Inner.show()";
15 }
16 };
17 }
18
19 public static void main(String[] args) {
20
21 Outter outter = new Outter();
22 Inter inter = outter.inter();
23 System.out.println(inter.show());
24 }
25 }
this is Outter.Inner.show()
上一篇:python实现钉钉报警
文章标题:[20-05-18][Thinking in Java 26]Java Inner Class 10 - Anonymous Inner Class 5
文章链接:http://soscw.com/index.php/essay/43632.html