Java 8 functional interface with no arguments and no return value(Java 8 函数式接口,无参数,无返回值)
问题描述
Java 8 函数式接口对于什么都不接受也不返回什么的方法是什么?
What is the Java 8 functional interface for a method that takes nothing and returns nothing?
即,等效于 C# 无参数 Action
与 void
返回类型?
I.e., the equivalent to to the C# parameterless Action
with void
return type?
推荐答案
如果我理解正确,你想要一个带有方法 void m()
的函数式接口.在这种情况下,您可以简单地使用 Runnable
一个>.
If I understand correctly you want a functional interface with a method void m()
. In which case you can simply use a Runnable
.
这篇关于Java 8 函数式接口,无参数,无返回值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Java 8 函数式接口,无参数,无返回值


基础教程推荐
- 大摇大摆的枚举 2022-01-01
- 从 python 访问 JVM 2022-01-01
- 在 Java 中创建日期的正确方法是什么? 2022-01-01
- 多个组件的复杂布局 2022-01-01
- Java 实例变量在两个语句中声明和初始化 2022-01-01
- 不推荐使用 Api 注释的描述 2022-01-01
- Java Swing计时器未清除 2022-01-01
- 如何在 JFrame 中覆盖 windowsClosing 事件 2022-01-01
- 如何在 Spring @Value 注解中正确指定默认值? 2022-01-01
- 验证是否调用了所有 getter 方法 2022-01-01