简体   繁体   English

箭头的事件队列含义

[英]eventqueue meaning of arrow

because I couldn't find anything in google that would explain that, I decided to turn myself to ask you what the arrow in this specific example does, I never saw that expression so I don't really get it what it does. 因为我在Google中找不到任何可以解释这一点的东西,所以我决定转身问你这个特定示例中的箭头的作用,我从未见过该表达式,所以我真的不明白它的作用。

Site I try to learn from: http://zetcode.com/tutorials/javagamestutorial/basics/ 我尝试从中学习的站点:http: //zetcode.com/tutorials/javagamestutorial/basics/

Thanks for helping!~ 感谢您的帮助!〜

   public static void main(String[] args) {

        EventQueue.invokeLater(() -> {
            Application ex = new Application();
            ex.setVisible(true);
        });
    }

It's part of a lambda expression , which is a shorthand for defining functions. 它是lambda表达式的一部分,它是定义函数的简写。 This creates a class with a method that takes no arguments and executes the statement block. 这将创建一个带有不带任何参数的方法的类,并执行语句块。

() -> {
    Application ex = new Application();
    ex.setVisible(true);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM